code: def sh(cmd, grid=False, infile=None, outfile=None, errfile=None,
          append=False, background=False, threaded=None, log=True,
          grid_opts=None, silent=False, shell="/bin/bash", check=False):
      
      if not cmd:
          return 1
      if silent:
          outfile = errfile = "/dev/null"
      if grid:
          from jcvi.apps.grid import GridProcess
          pr = GridProcess(cmd, infile=infile, outfile=outfile, errfile=errfile,
                           threaded=threaded, grid_opts=grid_opts)
          pr.start()
          return pr.jobid
      else:
          if infile:
              cat = "cat"
              if infile.endswith(".gz"):
                  cat = "zcat"
              cmd = "{0} {1} |".format(cat, infile) + cmd
          if outfile and outfile != "stdout":
              if outfile.endswith(".gz"):
                  cmd += " | gzip"
              tag = ">"
              if append:
                  tag = ">>"
              cmd += " {0}{1}".format(tag, outfile)
          if errfile:
              if errfile == outfile:
                  errfile = "&1"
              cmd += " 2>{0}".format(errfile)
          if background:
              cmd += " &"
  
          if log:
              logging.debug(cmd)
  
          call_func = check_call if check else call
          return call_func(cmd, shell=True, executable=shell)
docs: simple wrapper for system calls