Open main menu

CDOT Wiki β

Changes

Tutorial 10 - Shell Scripting - Part 1

214 bytes removed, 13:45, 14 November 2021
INVESTIGATION 4: USING CONTROL FLOW STATEMENTS IN SHELL SCRIPTS
# Issue the following Linux command to add execute permissions for your shell script:<br><span style="color:blue;font-weight:bold;font-family:courier;">chmod u+x for-2.bash</span><br><br>[[Image:for-2.png|thumb|right|175px|Output of a shell script using the '''for''' loop <u>without</u> a '''list'''.]]
# Run your shell script by issuing:<br><span style="color:blue;font-weight:bold;font-family:courier;">./for-2.bash 10 9 8 7 6 5 4 3 2 1</span><br><br>How does this differ from the previous shell script?<br>You will learn in a couple of weeks more examples of using loop statements.<br><br>Let's run a '''checking-script''' to confirm that both your '''for-1.bash''' and '''for-2.bash'''<br><br>
# Issue the following Linux command to run a checking script:<br><span style="color:blue;font-weight:bold;font-family:courier;">~osl640/week10-check-4 | more</span><br><br>If you encounter errors, make corrections and '''re-run''' the checking script until you<br>receive a congratulations message, then you can proceedto the practice questions.<br><br># After you complete the Review Questions sections to get additional practice, then work on your '''online assignment 3''',<br>'''sections 2 and 3''' labelled '''Interactive Shell Environment''' and '''Introduction To Scripting (phone)'''.
= LINUX PRACTICE QUESTIONS =