Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Please Help me to, Understand the "SCRIPT"

Status
Not open for further replies.

myunix

Technical User
Aug 5, 2002
1
SG
Hi Friends,
I am new to the IBM-AIX World. Can any body, help me to understand what does the following script do?

---------
QUERY='echo $1 |tr "[A-Z]" "[a-z]".sql

#Create the body of SQL(OTXUP20.sql)
build ()
{
SQL='cat $YDEBTSQL/$QUERY'
cat $YDEBTSQL/insertCT.sql > $YDEBTSQL/OTXUP20.sql
if [ "$?" != "0" ]
then
exit 9
fi
echo "SQL" >> $YDEBTSQL/OTXUP20.sql
if ["$?" !="0"]
then
exit 9

fi
cat $YDEBTSQL/exit.sql >> YDEBTSQL/OTXUP20.sql
if ["$?" !="0"]
then
exit 9
fi
}
runit()

--------
Thanks lot in Adv

Regards
Shah

 
QUERY is translating all upper case letters to lowercase from the input that was entered in field 1.

Then inside the function build it is doing a cat of the file (whatever variable $YDEBTSQL is set for)/insertCT.sql and sending it to OTXUP20.sql; then if the return code from the cat was not successful it exits else it echoes SQL and appends it to the previously created file OTXUP20.SQL and if not successful exits; the last is a cat of exit.sql and appends to the same file OTXUP20.sql and if unsuccessful it exits.

runit() is a function that is not listed along with the variable $YDEBTSQL.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top