QuestionQ13

Shells and Shell Scripting

What output will be displayed when the user fred runs the following command?

echo 'fred $USER'

  • A fred fred
  • B fred /home/fred/
  • C 'fred $USER'
  • D fred $USER
  • E 'fred fred'
Explanation

Single quotes prevent shell parameter expansion, so $USER remains literal text. The shell removes the enclosing quotation marks before invoking echo, which prints fred $USER.

Community Discussion

No comments yet. Be the first to start the discussion!