Pattern: Use of possibly unsupported flag
Issue: -
External commands (grep
, ls
, find
) invoke a binary on the system and therefore accept the same flags from all shells.
However, some commands are instead built into the shell and therefore accept different flags depending on which shell is running them.
You have specified sh
or dash
in the shebang, but the flags you are using only works when it's executed in e.g. bash
. You should either explicitly declare that the script requires bash
to run, or you should only use features that work on all shells.
Example of incorrect code:
#!/bin/sh
read -e # Using libreadline
export -f # Exporting functions
ulimit -v # Setting vspace limits
wait -n # Waiting for a single process