3 ms·
That's very nice, it's POSIX-compliant when invoked as #!/bin/sh and sane when invoked as #!/bin/bash — exactly what I'd want.
by ericbarrett 5y ago
That's very nice, it's POSIX-compliant when invoked as #!/bin/sh and sane when invoked as #!/bin/bash — exactly what I'd want.
- chasil 5y agoIf you want a portable script, then you don't want that behavior.
- ericbarrett 5y agoThen I wouldn't put #!/bin/bash at the top.
- chasil 5y agoYour problem there is Ubuntu/Debian. A bash script that runs as /bin/sh might not run as /bin/bash, until you set POSIXLY_CORRECT. Easiest solution there is to move it to a better shell, usually a Korn variant.