Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Incomplete list of safety shortcomings in POSIX shell
Incomplete list of safety shortcomings in POSIX shell
NEVER leave your variables unquoted.
And variables with common prefixes without braces.
Always clean up your environment to prevent stack smashing.
Better use `test [expression]` and dont dare to ask why
`[ 12 -le 13 ]` is also part of POSIX shell.
And why there are spaces and what happens if you forget them.
You can not in a POSIX way reliably and sanely short
1. check if symbols is defined in a script.
2. detect if a script is being sourced
3. get the current directory of the script.
4. how to find files in PATH (standard is ambiguous how it should work)
Shells are for exactly 3 purposes of very limited sized programs and use
an ideally type-checked language otherwise:
1. filepath manipulation with globbing and alike
2. piping programs and their output
3. simple execution flow with respective job control
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment