shell
osh is a great drop in bash replacement
Apr 23, 2025Nine Reasons to Use OSH oils.pub
I’ve starting using osh for testing my bash scripts (mostly used in build and deployments). It’s been great for both giving better error messages and spotting problems shellcheck mightn’t catch.
This has been my favourite so far:
osh -o strict:all ./myscript.sh
if assert_task_definition_is_older "${task_definition}" "deployed"; then
^~
myscript.sh:119: errexit was disabled for this construct
if assert_task_definition_is_older "${task_definition}" "deployed"; then
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
myscript.sh:119: fatal: Can't run a proc while errexit is disabled. Use 'try' or wrap it in a process with $0 myproc
This leads to this interesting note on how errexit
and if
statements invoking shell functions lead to surprising behaviour (basically errexit is disabled).