What does the “cat ‘$TEST’ ” command do?

What does the following command do?

cat ‘$TEST’

What does the following command do?

cat ‘$TEST’

A.
Displays a bash syntax error message.

B.
Displays the contents of the file named $TEST if it exists.

C.
Waits for the user to enter text and then echos the text back.

D.
Displays the contents of the file named inside the back quotes.

E.
Displays the contents of the named by the environment variable TEST.

Explanation/Reference:
single quotation marks instruct the bash not to do wildcard expansion or variable replacement, so cat will display the file called exactly $TEST
use double quotation marks to get variable replacement, but not wildcard replacement, and no quotations to get both.
Do not confuse with `cmd` which evaluates the command and replaces its output on the shell.



Leave a Reply 0

Your email address will not be published. Required fields are marked *