QuestionQ27

VerifiedEssential Commands

Which of the following commands will correctly set the variable named text to the value olaf is home?

Choose two
Explanation

A shell variable assignment cannot contain unescaped whitespace in its value unless that whitespace is escaped with a backslash or the value is enclosed in quotes. Escaping each space with a backslash (text=olaf\ is\ home) produces the literal string 'olaf is home', and enclosing the value in double quotes (text="olaf is home") preserves the spaces as part of the single value assigned to text. Both are standard, valid ways to assign a multi-word string to a shell variable.

Learn more

Community Discussion

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