What is the output of the following command, if executed using the default shell for the root
account of a standard Live CD Install of Oracle Solaris 11?
echo ‘$SHELL’
A.
/usr/bin/bash
B.
/usr/bin/ksh
C.
$SHELL
D.
the PID for the current shell
Explanation:
Single quotes are most strict. They prevent even variable expansion. Double quotes
prevent wildcard expansion but allow variable expansion. For example:
#!/bin/sh
echo $SHELL
echo “$SHELL”
echo ‘$SHELL’
This will print:
/usr/bin/bash
/usr/bin/bash
$SHELL
Please correct me if I’m wrong but for me the correct answer is
/usr/bin/bash
@joey :
# echo `$SHELL´
> ^C
# echo ‘$SHELL’
$SHELL
# echo $SHELL
/usr/bin/bash
C is correct
C is correct.
However the question is misspelled and should read:
echo ‘$SHELL’
(the second quote is incorrect)
Nice Explain,,..ton_adam…good..correct answer is “C”.
definitely C.
‘ quotes are the most strict and will be literal to what is displayed within them.
What is the point of this question?
Is it a trick?
C