The First Line of a shcll script
#!/bin/sh    (Bourn shell identifier)
#!/bin/csh  (C shell identifier)
#!/bin/ksh  (Korn shell identifier)
#!/bin/tcsh (
The first line, ``#!/bin/sh'', identifies the file as a shell script and tells the shell how to execute the script. It instructs the shell to pass the script to /bin/sh for execution, where
/bin/sh is the shell program itself. Why is this important? On most Linux systems, /bin/sh is a Bourne-type shell, like bash. By forcing the shell script to run using /bin/sh, you ensure that the script will
run under a Bourne-syntax shell (rather than a C shell). This will cause your script to run using the Bourne syntax even if you use tcsh (or another C shell) as your login shell.

Using The "export" Command to Change Shell Environment
Set PAGER to ``cat''. This causes output from man to be displayed to the screen all at once, without pausing between pages.
root # PAGER=cat
Now, export PAGER to the environment.
root # export PAGER
Try the command man ls. The man page should fly past your screen without pausing for you.

Now, if we set PAGER to ``more'', the more command is used to display the man page.
root # PAGER=more
Note that we don't have to use the export command after we change the value of PAGER. We only need to export a variable once; any changes made to it thereafter will automatically be propagated to the
environment.
 
 

This script works well in a menu and will exit the user if they do not enter a response and only presses the ENTER key to a menu question.
I have used this script to make sure users enter a absolute directory path when running a restore from a backup tape. If this option was not
used the entire content of the backup would be restored. You can also use this script to make sure a user enters somthing like a Yes or No when
being prompted by the menu.
###################### Checking if user enters something as a response ########
if [ X$name = X ]; then
clear
echo "\n\n   Please enter absolute directory path for restore"
echo "\n\n   Please try agin."
echo "\n\n\n"
echo "\n\n   Press ENTER To continue \c"
read answer
exit
fi
#############################################################################
 
 

This shell script works great in conjuction with the above script. It will determain if the user entered "t" or "s" as a response to a menu question. When the user enters
a response it checks for what was entered and "egrep -i" will check the letter case. If the user enters anything other than "t" or "s" the script will exit them out of
the program.

########################## Checks if is 't' or 's' is  entered ###################

echo $response | egrep -i "t|s" > /dev/null 2>&1 # checks if is 't' or 's' is  entered
if [ $? != 0 ];then
clear
echo "\n\n Please enter 'T' for TAR or 'S' for SYSBACK backup"
echo "\n\n Please try again "
echo "\n\n\n"
echo "\n\n Press ENTER To continuse \c"
read answer
exit
fi
 
 

############### Check for tape in drive ###################

#rewind tape before backup
mt -f /dev/rmt0 rewind

# Check for tape in drive

tape_stat=$?

while [ $tape_stat -ne 0 ]
do echo "\n\nNo Tape in Drive ....Please Put A Tape In The Drive"
       sleep 5

        mt -f /dev/rmt0 rewind
        tape_stat=$?
done
fi
tape_stat=$?

while [ $tape_stat -ne 0 ]
do echo "\n\nNo Tape in Drive ....Please Put A Tape In The Drive"
       sleep 5

        mt -f /dev/rmt0 rewind
        tape_stat=$?
done

tctl -f /dev/rmt0 rewind