unix shell scripts


=================================================================
Sample Scripts 1 - While loop and use of exec function
=================================================================
#!/bin/bash
function show_usage {
   echo "Usage: $0 filename instancename grantstype"
   exit 1
 }

# check for the no of arguments

if [ $# -ne 3 ]; then
show_usage
fi

# Define the variable

instancename=$2
grantstype=$3

# Read the file and do the processing on each line

exec 0<$1
while read line; do
echo "export OUSER=$line@$instancename"
echo "mygrantscommand $3"
done

=================================================================

Comments