Complete the code to enable error on undefined variables.
set [1]The set -u option makes the shell treat unset variables as an error when substituting.
Complete the script to exit on undefined variable usage.
#!/bin/bash set [1] echo "$MY_VAR"
Using set -u causes the script to exit if MY_VAR is not set.
Fix the error by completing the code to enable undefined variable errors.
set [1] if [ -z "$UNDEF_VAR" ]; then echo "Variable is empty" fi
Using set -u causes the script to error if UNDEF_VAR is not set, preventing silent empty checks.
Fill both blanks to enable error on undefined variables and print a message.
set [1] echo "Value: $[2]"
set -u enables error on undefined variables. Using MY_VAR prints the variable value.
Fill all three blanks to enable error on undefined variables, assign a value, and print it.
set [1] [2]="Hello" echo "Message: $[3]"
set -u enables error on undefined variables. We assign greeting and print it.