Skip to main content
Linux AdministrationMediumSingle Choice

Linux Administration Question

Statement

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

#bash-variable-assignment#variable-syntax#shell-variables#no-spaces-around-equals
A

set TEST="FOO"

B

TEST = "FOO"

C

var TEST="FOO"

D

TEST="FOO"

Correct

Resolution & Explanations

In Bash, the correct syntax to assign a value to a variable is VARIABLE_NAME=value with no spaces around the = sign. The command TEST="FOO" correctly sets the variable TEST to the string FOO.