Shell Scripting for Beginners
How to learn Shell Script with basic working understanding of Unix/Linux like environment
Shell scripting is one of the most powerful scripting language that helps not only system administrator to automate their day to day work but also helps developers to automate all the supporting processes required for them to build any kind of software application. To learn shell script, I tried to create Shell Script Tutorial series that may help beginners to understand all the fundamentals required to build shell script. Here you go with all the details on which part covers what all topics -
Part1 (Introduction-1) — This part covers:
1. Brief history about shell script
2. What is Shell?
3. What is shell scripting & why do we need it? When to use it?
4. Writing shell script to automate the execution of few basic commands like mkdir, cd, touch
5. How to make shell script executable
6. How to write Hello World script
Part2 (Introduction-2) — This part covers:
This part covers more conceptual knowledge about shell script on -
1. Why to use shebang/hashbang line within shell script & what is impact & why to use it?
2. Importance of EXIT command, When & why to use it?
3. Brief about CHMOD command
Part3 (Variables) — This part covers:
1. What is variable in Shell
2. Why do we need Variable & when to use it?
3. What all types of Variables in Shell
Part4 (User Defined Variables Interesting Behavior) — This part covers:
1. Interesting behavior of variables when variable’s value has spaces in between
2. How shell behaves when shell has undefined variable
3. How to configure shell script to throw error in case there is any undefined variable
3. few mistakes which most of the programmers beginners
Part5 (Types of Variables & How to access Environment Variables) — This part covers:
1. Types variables
i. Environmental variables
ii. Shell variables ( special variables set by shell)
2. How can we access environmental variables — PRINTENV, ENV, SET, EXPORT to view environmental variables
3. Usage of EXPORT & SET command to set or unset environment variable
Part6 ( How to pass and access command line arguments and shell Variables) — This part covers:
1. What is argument & how to pass arguments to shell scrip through command line
2. How to access command line arguments within shell script
3. What all shell variables are defined by system for any running shell script & how to access then within Script
Part7 (Array, Array Manipulation through shell script) — This part covers
1. What is Array?
2. How to define array in shell script? How array in shell is different from other high level programming languages?
3. How to access specific & all elements in array?
4. How to find total number of elements in array & also length of specific elements?
5. How to delete specific & all elements from array with unset command
Part8 (For Loop, Array Manipulation through For Loop) — This part covers
1. What is For Loop? How to use it in Shell?
2. Array manipulation through For loop
3. Different behavior for [@] [*} with and without double quote
4. Substring search & replacement for all array elements
5. How to delete all elements from array with unset command
Part9 (IF-ELIF-ELSE-FI Loop, Operators) — This part covers
1. What is Conditional statement & how to use IF-ELIF-ELSE-FI in Shell?
2. How to check number of arguments passed through command line with IF-ELIF-ELSE-FI
3. All types of IF command structure like IF-FI, IF-ELSE-FI, IF_ELIF-ELSE-FI
4. How to verify whether variable has empty string or not
Part10 (CASE-ESAC for Decision Making) — This part covers
1. What is Case statement & Structure/Syntax of Case statement?
2. How to use within Shell script for evaluating command line arguments?
3. Why CASE is more useful as compare to IF-ELSE when multiple options to be considered to make decision on logical flow?
4. Real time use case for executing database operations like select, insert, update, delete based on command line passed arguments
Part11 (FUNCTION in Shell {When to use & Why}) — This part covers
1. What is Function? How to define use function in shell?
2. When to use Function and Why?
3. Real time use case for creating function with multiple interaction with database to perform select, insert, update, delete based on command line passed arguments
4. How to pass arguments to function within shell?
Upcoming part will be keep adding as it goes live on youtube… Until next video “Stay Healthy, Keep Learning”.