Open main menu

CDOT Wiki β

Changes

INVESTIGATION 3: QUOTING SPECIAL CHARACTERS
# Issue the following Linux command: <span style="color:blue;font-weight:bold;font-family:courier;">echo "* hello *"</span><br><br>Is there a difference between this command and the previous command?<br><br>
# Issue the following Linux command: <span style="color:blue;font-weight:bold;font-family:courier;">echo '* hello *'</span><br><br>Is there any difference between this command and the two previous commands?<br><br>
#Issue the following Linux command: <span style="color:blue;font-weight:bold;font-family:courier;">echo $USER</span><br><br>NOTE: USER is an environment variable that stores the current user's login name. The $ character immediately followed by the environment name causes it to expand to the value that the variable contains. Therefore the echo command displays the current login name of the user.<br><br># Issue the following Linux command (using single quotes): <span style="color:blue;font-weight:bold;font-family:courier;">echo '$USER'</span><br><br>What happened? Why is the output display like this?<br><br># Issue the following Linux command (using double quotes): <span style="color:blue;font-weight:bold;font-family:courier;">echo "$USER"</span><br><br>What happened? Why?<br><br># Let's use quoting special characters for a couple of other commands. Move to the '''lesson2''' directory. Confirm that you are currently located in the ''lesson2'' directory.<br><br># Issue the following Linux command: <span style="color:blue;font-weight:bold;font-family:courier;">
<br><br>
13,420
edits