What output will be displayed when the user fred executes the following command? echo 'fred $USER'
What output will be displayed when the user fred executes the following command? echo 'fred $USER'
When the user executes the command echo 'fred $USER', the single quotes around 'fred $USER' will prevent the shell from interpreting the $USER variable, treating it as a literal string. Therefore, the output will be exactly what is inside the single quotes, which is fred $USER.
single quotes will suppress the special meaning of $ sign and treat it literally outputting what literally is inside of the single quotes
D supposed to be correct, but actually the question is wrongly written: `fred $USER' command would output a > prompt since it is mixing 2 quotation types. It supposed to be 'fred $USER' (single quotation type), this is easy to test and result are the same with a regular user and root.
Correct Tested
Answer: D