[lug] Shell Script
Pete Krawczyk
petek at bsod.net
Sun Aug 27 20:50:12 MDT 2000
Date: Fri, 25 Aug 2000 10:40:34 -0600
From: Bob Collins <bcollins at csd.net>
Subject: [lug] Shell Script
}<<QUERY_INPUT
} ...
}QUERY_INPUT
This is called a "here" redirect and it means that when whatever is
contained on all lines in the rest of the script up until that expression
is encountered on a line by itelf is passed to the encountered command
on standard input. Thus...
cat <<EXPRESSION
Random Text
EXPRESSION
shows "Random Text" on standard output because cat takes standard input
and gives it to standard output.
In your case, it's starting the MySQL command interface and handing it a
query, which MySQL runs and shows on standard output. It takes the first
argument to the script (in $1) and looks for a first name, last name,
email and interest where the interest has the command line argument in it.
It then displays those results on the screen.
-Pete K
--
Pete Krawczyk
petek at bsod dot net or pkrawczy at uiuc dot edu
http://www.uiuc.edu/ph/www/pkrawczy/
Finger pkrawczy at uiuc dot edu for PGP public key
More information about the LUG
mailing list