Which of the following command sets the Bash variable named TEST with the content FOO?
Correct Answer: D
Explanation
The correct way to set a Bash variable is to use the syntax variable=value without any spaces around the equal sign. The value can be enclosed in double quotes if it contains spaces or special characters, but it is not mandatory. Therefore, TEST="FOO" will set the Bash variable named TEST with the content FOO. The other options are either invalid or do not perform the desired task. The set command is used to set or unset shell options and positional parameters, not variables. The var command is not a valid Bash command. The TEST =
"FOO" syntax will cause a syntax error because of the spaces around the equal sign. References:
* LPIC-1 Exam 101 Objectives, Topic 103: GNU and Unix Commands, 103.1 Work on the command line
* LPIC-1 Linux Administrator 101-500 Exam FAQ, LPIC-1 Exam 101 Objectives, GNU and Unix Commands (Total Weight: 25)