In a nutshell, shell scripts encapsulate a series of commands that we'd normally run in the shell.
With shell scripts, a sequence of such commands can be written, saved in a text file, and ran whenever needed, sparing us from having to type long commands every time we want to perform that task.
There are different types of shells, with some differences between them.
The shell used in a script can be found in the first line (shebang
which shBourne shell
which bashBourne-again shell
which cshC shell
which will be indicated its location on the machine you are running.
#!/bin/sh # firts line is not comment # "#!/bin/sh" indicate what shell to use: in this case sh or Bourn sh date # date command loggedusers=`users` # result from users is given to variable loggedusers for i in $loggedusers # loop through each of the logged in users do echo $i | figlet # echoing ech item to figlet echo 'in da house' | cowsay # echo some corny line #cow say sleep 1 # sleeping for 1 sec done
Shell scripts can be easily timed (run every hour, every Sunday 5am, every minute, etc) using a 
Each Linux/UNIX user can write cron-jobs by editing the cron file with