In-reply-to » I love shell scripts because they’re so pragmatic and often allow me to get jobs done really quickly.

And errors out expectedly using dash or ash, very nice POSIX Sh compliant shells:

$ ./foo.sh
./foo.sh: line 5: [: bar: integer expression expected

So the lessons here are twofold:

  • Always use shellcheck to check your shell code
  • Never use Bash or rely on Bash(isms). Always prefer POSIX Sh

⤋ Read More