Skip to content

danielgreve/from-sh-import-all

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Use Python as a pseudo-shell with sh

How to run

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

Examples

>>> ls()
LICENCE.md              README.md               from-sh-import-all.py

>>> git.init("README.md")

>>> echo("Hello")
Hello

>>> 

Why would you want to do this?

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.

Further reading

About

An interactive pseudo-shell embedded in Python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages