Ever wished the wrist-handiness of shellscripts be put into a real programming language? Say helloto Plumbum Shell Combinators. Plumbum (Latin for lead,which was used to create pipes back in the day) is a small yet feature-richlibrary for shell script-like programs in Python. The motto of the libraryis "Never write shell scripts again", and thus itattempts to mimic the shell syntax ("shellcombinators") where it makes sense, while keeping it all pythonicand cross-platform.
Apart from shell-like syntax and handyshortcuts, the library provides local and remote command execution (over SSH),local and remote file-system paths, easy working-directory and environmentmanipulation, and a programmatic Command-Line Interface (CLI) applicationtoolkit. Now let's see some code!
This is only a teaser; the fulldocumentation can be found at Read the Docs
CODE:
>>> from plumbum import local, FG, BG来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/301743/viewspace-731270/ ,如需转载,请注明出处,否则将追究法律责任。