Is there a way to set the current working directory within a call to the Python sh module?
I'd like to be able to execute a command --- and only the command --- in a different directory than the one I'm currently in. Something along the lines of:
foo = sh.ls(_current_directory="/tmp")
_cwd parameter to set the current working directory on a per-command basis:
import sh print(sh.ls(_cwd='/tmp'))
This works for any command, not just