Currently, all scripts are written to run on the ancient Bourne Shell for maximum backward compatibility.
However, on many modern systems, the 'sh' executable is just a link to 'bash' which is fully Bourne Shell compatible.
So in the most frequent use case, we should actually have full BASH capabilities available, even if using "/bin/sh" as interpreter.
BASH has some built-in commands for arithmetics and data structures that can tremendously speed up repetitive operations.
Currently, such operations are a huge bottleneck whenever they involve calling an external command, such as 'expr'.
E.,g., an easy speed-up of loop integer increments for all BASH-capable (i.e. pretty much all modern) systems looks like this (using internal 'let' instead of external 'expr'):
if [ -n $BASH_VERSION ] ; then
let counter=${counter}+1
else
counter=`"${EXPR}" ${counter} + 1`
fi
Currently, all scripts are written to run on the ancient Bourne Shell for maximum backward compatibility. However, on many modern systems, the 'sh' executable is just a link to 'bash' which is fully Bourne Shell compatible.
So in the most frequent use case, we should actually have full BASH capabilities available, even if using "/bin/sh" as interpreter.
BASH has some built-in commands for arithmetics and data structures that can tremendously speed up repetitive operations. Currently, such operations are a huge bottleneck whenever they involve calling an external command, such as 'expr'.
E.,g., an easy speed-up of loop integer increments for all BASH-capable (i.e. pretty much all modern) systems looks like this (using internal 'let' instead of external 'expr'):