03-30-2009
2,
0
Join Date: Mar 2009
Last Activity: 30 March 2009, 10:47 AM EDT
Posts: 2
Thanks Given: 0
Thanked 0 Times in 0 Posts
Parameterised Call to MySQL
Hi,
I am trying to do a mysql insert from a script, using a parameter which holds a value taken from a filename. I must be missing something as the param is not holding any value.
Any suggestions please; (input files will look like aaa.123.dat)
#/bin/bash
# 30th March 2008
for filename in *.dat
do
set PARAM1 = `echo - $filename | cut -d'.' -f1`
set PARAM2 = `echo - $filename | cut -d'.' -f2`
set PARAM3 = `echo - $filename | cut -d'.' -f3`
done
mysql -u root -pPassword -h??.???.???.??? database_name -e "insert into test (test_field) values ($PARAM2)"