Difference between revisions of "Tutorial 10 - Shell Scripting - Part 1"
Line 1: | Line 1: | ||
Content under construction | Content under construction | ||
+ | |||
+ | = INTRODUCTION TO SHELL SCRIPTING = | ||
+ | ===Main Objectives of this Practice Tutorial=== | ||
+ | |||
+ | :* Plan and create a Shell Script | ||
+ | |||
+ | :* Explain the purpose of the '''she-bang line''' contained at the top of a shell script. | ||
+ | |||
+ | :* Set '''permissions''' and '''execute''' shell scripts. | ||
+ | |||
+ | :* Use '''environment''' and '''user-defined''' variables in shell scripts. | ||
+ | |||
+ | :* Use '''Command Substitution''' and '''Math Operations''' in shell scripts | ||
+ | |||
+ | :* Explain the purpose of the '''$?''' exit status and the '''test''' command. | ||
+ | |||
+ | :* Use '''if''' and '''if-else''' logic statements in shell scripts. | ||
+ | |||
+ | :* Use a '''for''' loop statement with a list in shell scripts. | ||
+ | |||
+ | ===Tutorial Reference Material=== | ||
+ | |||
+ | {|width="100%" cellspacing="0" cellpadding="10" | ||
+ | |||
+ | |- valign="top" | ||
+ | |||
+ | |colspan="2" style="font-size:16px;font-weight:bold;border-bottom: thin solid black;border-spacing:0px;"|Course Notes<br> | ||
+ | |||
+ | |colspan="2" style="font-size:16px;font-weight:bold;border-bottom: thin solid black;border-spacing:0px;padding-left:15px;"|Linux Command/Shortcut Reference<br> | ||
+ | |||
+ | |colspan="1" style="font-size:16px;font-weight:bold;border-bottom: thin solid black;border-spacing:0px;padding-left:15px;"|YouTube Videos<br> | ||
+ | |||
+ | |- valign="top" style="padding-left:15px;" | ||
+ | |||
+ | |colspan="2" |Course Notes:<ul><li>[https://matrix.senecacollege.ca/~osl640/slides/OSL640-Week10.pdf PDF] | [https://matrix.senecacollege.ca/~osl640/slides/OSL640-Week10.pptx PPTX]</li></ul> | ||
+ | |||
+ | |||
+ | | style="padding-left:15px;" |Shell Scripting | ||
+ | * [https://searchdatacenter.techtarget.com/definition/shell-script Purpose] | ||
+ | |||
+ | Variables | ||
+ | * [https://opensource.com/article/19/8/what-are-environment-variables Environment] | ||
+ | * [https://www.linuxtechi.com/variables-in-shell-scripting/#:~:text=User%20Defined%20Variables%3A,like%20a%20real%20computer%20program. User Defined] | ||
+ | * [http://osr600doc.xinuos.com/en/SDK_tools/_Positional_Parameters.html#:~:text=A%20positional%20parameter%20is%20a,up%20to%20nine%20positional%20parameters. Positional Parameters] | ||
+ | Commands / Techniques | ||
+ | * [http://linuxcommand.org/lc3_man_pages/readh.html read] | ||
+ | * [https://man7.org/linux/man-pages/man1/readonly.1p.html readonly] | ||
+ | * [https://www.gnu.org/software/bash/manual/html_node/Command-Substitution.html Command Substitution] | ||
+ | | style="padding-left:15px;"|Control Flow Statements | ||
+ | * [https://en.wikipedia.org/wiki/Control_flow Purpose] | ||
+ | * [https://www.computerhope.com/unix/test.htm test command] | ||
+ | * [https://ryanstutorials.net/bash-scripting-tutorial/bash-if-statements.php#:~:text=If%20statements%20(and%2C%20closely%20related,conditions%20that%20we%20may%20set. if statement] | ||
+ | * [https://www.tutorialspoint.com/unix/if-else-statement.htm if-else statement] | ||
+ | * [https://www.cyberciti.biz/faq/bash-for-loop/#:~:text=A%20'for%20loop'%20is%20a,files%20using%20a%20for%20loop. for loop] | ||
+ | |||
+ | |colspan="1" style="padding-left:15px;" width="30%"|Instructional Videos:<ul><li>[https://www.youtube.com/watch?v=kxEP-KUhOSg&list=PLU1b1f-2Oe90TuYfifnWulINjMv_Wr16N&index=5 Bash Shell Scripting - Part 1]</li><li>[https://www.youtube.com/watch?v=cQepf9fY6cE Creating and Running a Shell Script]</li></ul> | ||
+ | |} | ||
= INVESTIGATION 1: CREATING A SHELL SCRIPT = | = INVESTIGATION 1: CREATING A SHELL SCRIPT = |
Revision as of 13:33, 14 November 2021
Content under construction
Contents
INTRODUCTION TO SHELL SCRIPTING
Main Objectives of this Practice Tutorial
- Plan and create a Shell Script
- Explain the purpose of the she-bang line contained at the top of a shell script.
- Set permissions and execute shell scripts.
- Use environment and user-defined variables in shell scripts.
- Use Command Substitution and Math Operations in shell scripts
- Explain the purpose of the $? exit status and the test command.
- Use if and if-else logic statements in shell scripts.
- Use a for loop statement with a list in shell scripts.
Tutorial Reference Material
Course Notes |
Linux Command/Shortcut Reference |
YouTube Videos | ||
Course Notes:
|
Shell Scripting
Variables Commands / Techniques |
Control Flow Statements | Instructional Videos: |