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?

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’

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



Leave a Reply 8

Your email address will not be published. Required fields are marked *


joey

joey

Please correct me if I’m wrong but for me the correct answer is
/usr/bin/bash

Richie

Richie

@joey :
# echo `$SHELL´
> ^C
# echo ‘$SHELL’
$SHELL
# echo $SHELL
/usr/bin/bash

david

david

C is correct

ton_adam

ton_adam

C is correct.

However the question is misspelled and should read:

echo ‘$SHELL’

(the second quote is incorrect)

Mir

Mir

Nice Explain,,..ton_adam…good..correct answer is “C”.

John

John

definitely C.

‘ quotes are the most strict and will be literal to what is displayed within them.

Vinicius Torres

Vinicius Torres

What is the point of this question?

Is it a trick?