example sh script.
I wrote this script which does nothing functionally useful; however, its source code contains examples of a number of sh programming constructs. Once you've downloaded it, run the following command chmod 700 example1 and you will be able to run the program in a manner similar to what follows.
% ./blah.sh -d -n 3 -v --version www /etc/group DEBUG mode is ON NUMBER is 3 VERBOSE mode is ON Version 0.2.4 Argument 1: www Argument 2: /etc/group Do you want to continue ? [y|N] y Continuing... Do you want to continue ? [y|n] a You have made an incorrect entry; next time enter 'y' or 'n'. Do you want to continue ? [y|n] b You have made an incorrect entry; next time enter 'y' or 'n'. Do you want to continue ? [y|n] y Continuing... The file named /tmp/blah_lock.74765 contains ( 3 ) lines. Type the name of a file to create: jkjkjk file: blah.sh file: gen-proxy.pl file: include.proxy The file name you entered is unique: jkjkjk ln -s /home/u0 /u0 ln -s /home/u1 /u1 ln -s /home/u2 /u2 ln -s /home/u3 /u3 ln -s /home/u4 /u4 ln -s /home/u5 /u5 ln -s /home/u6 /u6 ln -s /home/u7 /u7 ln -s /home/u8 /u8 ln -s /home/u9 /u9 ln -s /home/u10 /u10 All done.