Which of the following commands will set the variable text to olaf is home? (Select TWO answers)
A.
text=olaf\ is\ home
B.
text=$olaf is home
C.
$text=’olaf is home’
D.
text==’olaf is home’
E.
text=”olaf is home”
Which of the following commands will set the variable text to olaf is home? (Select TWO answers)
Which of the following commands will set the variable text to olaf is home? (Select TWO answers)
A.
text=olaf\ is\ home
B.
text=$olaf is home
C.
$text=’olaf is home’
D.
text==’olaf is home’
E.
text=”olaf is home”
i dont think this is the correct answer
My ans is ‘E’
Can any body please help
A and E
Answer A
Linux does not comprehend “white space” (Space Bar characters). However a \ (Back-slash) tells the Bash to expect a Space bar character. As a result
text=olaf\ is\ home will set the variable
Answer E
This is the usual method for creating variables, again “white space” needs to be addressed and it is with the “double quotes” which tells the Bash, to include everything within the double quotes.
The other answers are wrong because they use the wrong syntax. Know that A & E are correct and they are in the correct syntax
this should also help, it’s the same thing I just said, but more elaborate
http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-5.html
Thank you