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

A.

set TEST="FOO"

B.

TEST = "FOO"

C.

var TEST="FOO"

D.

TEST="FOO"

题解

「set」指令可以用来设置或是查看目前 shell 的设置值,也能查看所有变量的值。

选项 A,错误的「set」指令用法。

选项 B,指派变量值的时候,等号和左值、右值之间不能有空格。

选项 C,没有「var」指令。

选项 D,正确答案。