4 ms·
If your bash script is not trivial, and target machines have python, it's probably better to use sh: https://amoffat.github.io/sh/ https://amoffat.github.io/sh
by monort 11y ago
If your bash script is not trivial, and target machines have python, it's probably better to use sh:
https://amoffat.github.io/sh/ https://amoffat.github.io/sh/
- iberieve 11y agoFirst time I've seen this and it looks amazing. Poorly named perhaps, though it is certainly a nice option to be aware of! Thank you for sharing. One question - In this py-sh system are there error control options like what bash provides? e.g.: set -o errexit set -o pipefail set -o nounset
- monort 11y agoThese options are set by default - non zero exit code or unknown variable will raise an exception. You can catch it if you don't want to exit.
- heavenlyhash 11y agoLove amoffat's sh. love. Love it so much I wrote similarly styled libraries for both - go: https://github.com/polydawn/gosh https://github.com/polydawn/gosh - java: https://github.com/polydawn/josh https://github.com/polydawn/josh I particularly like the golang one, because it results in smallish (~1mb) files that can crash land on any linux with no other bootstrap at all... which while troubling for replacing your entire library of shell scripts, is great for bootstrapping. (For replacing your entire library of shell scripts, I just use it with `go run` after my bootstrap has installed the go toolchain.)
- rando289 11y agoSimilar ruby library. not as extensive since ruby has more shell-like features built in http://ruby-doc.org/stdlib-2.2.1/libdoc/shell/rdoc/Shell.html http://ruby-doc.org/stdlib-2.2.1/libdoc/shell/rdoc/Shell.htm...