How can I make bash treat undefined variables as errors?

You can use:

set -u

at the start of your script to throw an error when using undefined variables.

-u

Treat unset variables and parameters other than the special parameters “@” and “*” as an error when performing parameter expansion. If expansion is attempted on an unset variable or parameter, the shell prints an error message, and, if not interactive, exits with a non-zero status.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)