Logo

shell scripting

Posted under » Linux on 21 October 2009

A shell script is similar to the windows batch file. It will execute commands listed on the text file.

Create a file, say "test.sh"

#
# Script to print user information who currently login , current date & time
#
clear
echo "Hello $USER"
echo "Today is \ ";date
echo "Number of user login : \ " ; who | wc -l
echo "Calendar"
cal
exit 0

In order to run, chmod the file to make it executable. Execute it by typing the file name out with its location (relative or full) or type sh in front.

$ chmod 755 test.sh
$ ./test.sh
$ /var/script/test.sh
$ sh test.sh
Same with python eggs
$ sh whutever.egg