- Infos im HLRS Wiki sind nicht rechtsverbindlich und ohne Gewähr -
POSIX compliant shell scripting
POSIX compliant shell scripting is important if you want to write/use portable shell scripts. Basically, a generic shell script starts with:
which in itself is a link to a shell interpreter - like bash, ksh, etc.
Some popular shell languages are POSIX-compliant (Bash, Korn shell), but even they offer additional non-POSIX features which will not always function on other shells.
Example for a Bash constructs that is not POSIX compliant:
wn_slots=4 for ((n=1;$n <= $wn_slots; ++n)); do echo $n done
The commands test expression is identical to the command [expression] . In fact, many sources recommend using the brackets for better readability.
if test "$str1" = "$str2" if ["$str1" = "$str2" ] then then ... ... fi fi
Note: There is also the extended test facility which is not POSIX compliant and uses double brackets.
I recommend the Dash shell as a very minimalistic POSIX compliant shell