Shell Scripting Flashcards
What is a shell script for?
Automation
!
Schbang. Used to specify the shell or program that runs the shell script
Shel scripting variablez
All upper case
Case sensitive
$
Used to add a variable to a command in shell scripting
Add the ouput of a command to a variable by
Putting a $() around the output
[]
The wrapping for a condition in shell scripting
if []
then
Full conditional format for shell scripting
if []
then
else
Shell scripting with if / else
for var in item1 item2 (ect)
do
command 1
command 2
done
For in shell scripting. Note that you need to manually specify all iitems to iterate through
$0
The script
$1, $2 , $3
Parameters to feed when executing the script
Eg:
grep a b c
A = $1 ect
$@
How to get all the parameters inputted at once
read -p PROMPT
Used to get input from the user as STDIN