#!/usr/bin/bash ################################################## # V22.0202, Fall 2007, Chee Yap # Sample Shell Script # To execute this file, put it in a file named "foo.sh" # Make foo.sh executable (e.g., "chmod a+x foo.sh") # Now execute this file by invoking "foo.sh". # Result? You will see three identical files named # myfile, myhello, myworld. # What are their contents? ################################################## ################################################## # variables ################################################## p="hello world" ################################################## # simple action ################################################ echo "Hello World!" > myfile ################################################## # simple looping: ################################################## for x in ${list}; do \ cat myfile > my${x} done ################################################## # end ##################################################