First confirm the sh
module is installed, or install with pip
.
python -i from-sh-import-all.py
# Alternatively, for filename tab completion
ipython -i from-sh-import-all.py
>>> ls()
LICENCE.md README.md from-sh-import-all.py
>>> git.init("README.md")
>>> echo("Hello")
Hello
>>>
Honestly, you likely would not. Python syntax is terse, but not terse enough for a great shell experience. Plus, sh
does not implement interactive applications yet, so vim and the like would not be available unless you defined functions for them like so:
def vim(filename)
os.system("vim {}".format(filename))
Altogether, IPython provides a better interactive experience for system shell usage along with Python. However, sh
is a godsend for scripting with shell commands.