13,420
edits
Changes
→INVESTIGATION 1: BASICS OF REDIRECTION
# Issue the following Linux command:<br><span style="color:blue;font-weight:bold;font-family:courier;">grep 2 > line2.txt <<+<br>line 1<br>line 2<br>line 3<br>+</span><br><br>What do you notice? What is contained in the file '''line2.txt'''? Why?<br><br>'''NOTE:''' You will now run a shell script to confirm that you properly issued Linux commands using redirection.<br><br>
# 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/week5-check-1</span><br><br>
# If you encounter errors , make corrections and '''re-run''' the checking script until you receive a congratulations message, then you can proceed.<br><br>
# Issue the '''ls''' command to see all of the '''temporary files''' that were created as a result of redirection.<br><br>The problem with using these redirection symbols is that you create '''temporary text files''' that take up '''space''' on your file system.<br><br>
# Issue a Linux command to '''remove''' those temporary text files in the current directory.<br><br>
# Issue the following Linux command to check that you removed ALL of those temporary text files:<br><span style="color:blue;font-weight:bold;font-family:courier;">bash /home/murray.saul/scripts/week5-check-2</span><br><br>
# If you encounter errors , make corrections and '''re-run''' the checking script until you receive a congratulations message, then you can proceed.<br><br>
:In the next investigation, you will be learning how to issue '''pipeline Linux commands''' which can accomplish tasks <u>without</u> creating temporary files.<br><br>