I'm writing (or trying to write) a little program in POSIX sh (following the warnings of ShellCheck).
I am especially concerned with a WARNING regarding a loop which in POSIX would be wrong given the double brackets.
Could you tell me what the POSIX sh version of this code is:
while (( "$#" )); do
case "$1" in
[...]
esac
shift
done
$#it seems rather optional as ShellCheck ignores it, good to know. Thanks. – Vlastimil Burián Dec 17 '20 at 15:40IFSor thatIFSdoesn't contain digits. I'd consider this a buglet in ShellCheck. – Kusalananda Dec 17 '20 at 15:43getoptsdoes not support long options, but modern shells support long options viagetoptsin a unified way that has been originally been implemented ingetopt(3)on Solaris.bashdoes not support long options because it uses it's own version ofgetopt(3). See the Bourne Shell man page http://schilytools.sourceforge.net/man/man1/bosh.1.html (approx. page 48) for a documentation on how long options work. Note that this also works with ksh93 the same way. – schily Jan 31 '21 at 14:08