Intro to BASH scripting with a little AWK 
 
The following commands/programs will be used/discussed this week:
 
bourne 
bash 
korn 
cshell 
perl 
python 
./ 
chmod a+x 
' (backquote) 
echo 
awk -F '{print $1}'  
 
Scripting Concepts
 
variables 
getting input 
directing output 
Using Other programs 
List of Operators  
Control statements (if elif else fi) 
Control statements (case $1 in.....esac) 
Repetition Statements (while() and for() ) 
Functions (for modular program design 
Using Command Line Arguments ($0-$10)
 
Example Script
#!/bin/bash
#Note, that first line often must be changed to fit your system
file=~/diary
      date >> $file
      echo "Hello `whoami`, what did you do today?"
      read today
      echo "$today" >> $file
      echo >> $file
      echo "-----------------------------------------------" >> $file
      echo >> $file
Example Script 2
#!/bin/bash
set -o xtrace
echo "Do you believe the world is a sphere in shape?"
echo "Please answer y or n"
read answer
if [ $answer = y -o $answer = Y ]; then
        echo "Congrats, you live in the modern world"
elif [ $answer = n -o $answer = N ]; then
        echo "Get your head out of the sand you silly luddite"
else
        echo "What part of "Please answer y or n" don't you understand?";
fi
 |