- Infos im HLRS Wiki sind nicht rechtsverbindlich und ohne Gewähr -

Difference between revisions of "Editing POSIX compliant shell scripting"

From HLRS Platforms
Line 1: Line 1:
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:
    for ((n=1;$n <= $wn_slots; ++n)); do
          echo $n
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
Relevant links:

Latest revision as of 12:58, 25 February 2010