Changes

Jump to: navigation, search
INVESTIGATION 1: ABSOLUTE / RELATIVE / RELATIVE-TO-HOME PATHNAMES
# Issue the following Linux command: <span style="color:blue;font-weight:bold;font-family:courier;">cp /bin/ls ./ls.bk</span><br><br>What does this command do?<br><br>Let's run a checking script to make certain you performed the a few of the recently-issued commands correctly.<br><br>
# Issue the following: <span style="color:blue;font-weight:bold;font-family:courier;">bash /home/murray.saul/scripts/week3-check-2</span><br><br>
# If you encounter errors, make correct corrections and then re-run the checking script until you receive a congratulations message,<br>and proceed to the next INVESTIGATION.<br><br>
=INVESTIGATION 2: FILENAME EXPANSION=
= INVESTIGATION 3: QUOTING SPECIAL CHARACTERS =
As discussed in the above section, there are some special characters that the shell uses to perform an operation<br>including the filename expansion symbolssymbol: '''*''' or '''?''' 
There is a method make the shell '''ignore the purpose of special characters''' and treat as '''regular text'''.
# 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''': The environment variable '''USER''' contains the current user's login name.<br>The '''$''' character immediately followed by the environment variable name causes it to<br>expand to the '''value''' that the variable contains.<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. <br>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;">cp /bin/ls .</span><br><br># Issue the '''ls''' command to verify that there are copied files in your lesson2 directory.<br><br>'''NOTE:''' Although it is NOT RECOMMENDED to create a filename using a special character (remember that file naming rulerules?), <br>we will create an empty file called "*"<br><br>
# Issue the following Linux command (using single quotes): <span style="color:blue;font-weight:bold;font-family:courier;">touch '*'</span><br><br>
# Issue the '''ls''' command. Do you now see a file called "*" in addition to the other copied files?<br><br>
# Issue the following Linux command: <span style="color:blue;font-weight:bold;font-family:courier;">cp /bin/ls .</span><br><br>
# Issue the following Linux command (using single quotes): <span style="color:blue;font-weight:bold;font-family:courier;">touch '*'</span><br><br>
# Issue the '''ls''' command to view the files in your current directory.<br><br>
# Issue the following Linux command (using single quotes): <span style="color:blue;font-weight:bold;font-family:courier;">rm '*'<br><br>
# Issue the '''ls''' command to confirm that the file called "*" has been removed in your current directory. What happened this time?<br><br>
13,420
edits

Navigation menu