| SM Ryan 2005-06-29, 2:48 am |
| "jzz" <yojo101@hotmail.com> wrote:
# I want to use a unix shell script that interacts with a mysql database
# and executes queries on the database.
@ msq 'select * from config where name="thumbnaillength"' | od -xc
0000000 6e61 6d65 0976 616c 7565 0a74 6875 6d62
n a m e \t v a l u e \n t h u m b
0000020 6e61 696c 6c65 6e67 7468 0939 300a
n a i l l e n g t h \t 9 0 \n
0000036
# Is this possible? If so , How??
msq happens to be script in my ~/bin
#!/bin/sh
if [ $# -gt 0 ]
then
/usr/local/mysql/bin/mysql -uuser -ppassword -Ddatabase -B -e "$1"
else
/usr/local/mysql/bin/mysql -uuser -ppassword -Ddatabase
fi
exit 0
You can pass the output through other unix tools like awk.
--
SM Ryan http://www.rawbw.com/~wyrmwif/
God's a skeeball fanatic.
|