#!/bin/sh #here is an example of shift in action #you should run this for yourself. to do that #all you need to do is cut and paste this into your own script #or you may copy it directly to a directory of your own and re-name it to .sh #here we go, I will assume that the command line was: #shift.sh three little pigs echo The program you called '$0' was $0 echo You entered $# arguments '$#' at the command line echo '$1' has the value of $1 echo '$2' has the value of $2 echo '$3' has the value of $3 #notice that the single tics make the shell NOT evaluate the variable echo look in the code, there is a shift here echo -n now please press enter to activate the first shift #note how I use read to enable user interaction a variable called firstshift #was created but never used read firstshift shift echo '$1' has the value of $1 echo '$2' has the value of $2 echo '$3' has the value of $3 echo look in the code, there is a shift here echo -n now please press enter to activate the second shift #note how I use read to enable user interaction a variable called secondshift #was created but never used read shift2 shift echo '$1' has the value of $1 echo '$2' has the value of $2 echo '$3' has the value of $3 #notice that $3 and $2 no longer have any value, since they have been #shifted up echo Well that was actually pretty easy, now what about set sean? echo take a look at set.sh to learn about set #