A bash script needs to test whether a string variable $NAME is non-empty and equals 'admin'. Which of the following conditionals is correct?
The -n test confirms the string is non-empty, and && requires the equality check to also pass. Both conditions must hold for the branch to execute, precisely matching the stem's requirement that $NAME be populated and equal to 'admin'.
Why this answer
In bash, [[ -n $NAME ]] tests if the string is non-empty, and == compares strings. Using double brackets is safer for string comparison.