13,420
edits
Changes
→INVESTIGATION 2: FILENAME EXPANSION
<div style="font-family:courier;margin-left:50px;font-weight:bold;">abc.txt<br>def.txt<br>hij.TxT<br>1a4.txt<br>123.TXT<br>456.txt<br>6u9.txt<br>
ab2.txt<br>1234.txt<br>abcdef.txt<br>abcde.txt<br><br></div>
<ol><li value="4">Before proceeding, let's run a checking script to make certain that you created these regular files correctly:<br>Make certain that your current directory is '''your home directory'''.<br><br></li><li>Issue the following Linux command to run a checking script:<br><span style="color:blue;font-weight:bold;font-family:courier;">bash /home/murray.saul/scripts/week3-check-3</span><br><br></li><li>If you encounter errors and re-run the checking script until you receive a congratulations message, and continue in this section.<br><br>'''NOTE:''' To become comfortable with using filename expansion symbols, an excellent practice method is to create multiple files (you have already done that) and write down on a paper the expected output of commands that use filename expansion symbols. You can then run the command to see the results in order to check your work.<br><br>Let's try this for each of the situation below:<br><br></li><li>Issue the following Linux command: <span style="color:blue;font-weight:bold;font-family:courier;">ls ???.txt</span><br>Write down the expected output on paper, then issue the command to check your answer.<br><br></li><li>Issue the following Linux command: <span style="color:blue;font-weight:bold;font-family:courier;">ls ?????.txt</span><br>Write down the expected output on paper, then issue the command to check your answer.<br><br></li><li>Issue the following Linux command: <span style="color:blue;font-weight:bold;font-family:courier;">ls ??????.txt</span><br>Write down the expected output on paper, then issue the command to check your answer.<br><br></li><li>Issue the following Linux command: <span style="color:blue;font-weight:bold;font-family:courier;">ls [0-9].txt</span><br>Write down the expected output on paper, then issue the command to check your answer. Did the command work? What does this teach you about the character class [ ] symbol?<br><br></li><li>Issue the following Linux command: <span style="color:blue;font-weight:bold;font-family:courier;">ls [0-9][0-9][0-9].txt</span><br>Write down the expected output on paper, then issue the command to check your answer.<br><br></li><li>Issue the following Linux command: <span style="color:blue;font-weight:bold;font-family:courier;">ls [a-z][a-z][a-z].txt</span><br>Write down the expected output on paper, then issue the command to check your answer.<br><br></li><li>Issue the following Linux command (using character class with UPPERCASE letters): <span style="color:blue;font-weight:bold;font-family:courier;">ls [A-Z][A-Z][A-Z].txt</span><br>Write down the expected output on paper, then issue the command to check your answer.<br><br></li><li>Issue the following Linux command (using character class using alpha-numeric characters): <span style="color:blue;font-weight:bold;font-family:courier;">ls [a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9].txt</span><br>Write down the expected output on paper, then issue the command to check your answer.<br><br></li><li>Issue the following Linux command: <span style="color:blue;font-weight:bold;font-family:courier;">ls *.txt</span><br>Write down the expected output on paper, then issue the command to check your answer. Did ALL text files get listed? Why not?<br><br></li><li>Issue the following Linux command: <span style="color:blue;font-weight:bold;font-family:courier;">ls 8*.[tT][xX][tT]</span><br>Write down the expected output on paper, then issue the command to check your answer.Did ALL text files get listed this time? If so, why?<br><br></li></ol>
= INVESTIGATION 3: QUOTING SPECIAL CHARACTERS =