Improves your Bash scripts.
The following shebang
set -eby default:
$ echo hello ; false ; echo world
will only print
CMDfor showing executed commands in bold on stderr:
$ CMD git status
CMD_STRprints the string in bold on stderr and runs it with
$ CMD_STR 'gitk --all &'
MSGprints a remark in bold on stderr, formatted as a comment:
$ MSG hello world
# hello world.
read -pbut prints the first parameter using
$ READ_P 'What is your name? ' your_name
QUOTEDprints the given arguments in a way that is safe to pass to commands:
$ echo "My arguments are: $(QUOTED "$@")"
You can find a few examples in the examples directory.
Caveats / known limitations
You cannot just
bpkg install bashsh
to install bashsh locally (it is forced to install globally anyway), because if you use
the path of the command supplied to
env will be interpreted as relative to the working directory, not to the script’s directory.