Exam LFCS All QuestionsBrowse all questions from this exam
Question 81

Which of the following command sets the Bash variable named TEST with the content FOO?

    Correct Answer: D

    In Bash, the correct syntax to set a variable named TEST with the content FOO is TEST="FOO". This command assigns the string FOO to the variable TEST. The other provided options either use incorrect syntax or do not achieve the intended result.

Discussion
StribOption: D

D is correct

rona962Option: D

The command that sets the Bash variable named TEST with the content FOO is option D, TEST="FOO". Explanation: Option A, set TEST="FOO", sets the positional parameters of the current shell to TEST=FOO. It does not set the variable TEST. Option B, TEST = "FOO", attempts to run a command named TEST with two arguments, = and "FOO". It does not set the variable TEST. Option C, var TEST="FOO", is not valid Bash syntax for setting a variable. It is likely used in a different shell or programming language. Option D, TEST="FOO", sets the variable TEST to the string FOO. Therefore, to set the Bash variable named TEST with the content FOO, you should use the command TEST="FOO".