On 05/04/2011 12:00 AM, Les Mikesell wrote: > On 5/3/11 11:33 PM, Robert wrote: >> Hi All, >> >> I'm brand new at doing anything linux and would like feedback on this >> script I'm trying to understand from an example I'm working on.. >> >> Oh, running Centos 5.6 >> >> Anyhow, I run this bash script: >> >> #!/bin/bash >> # send data to the table in the MySQL database >> >> MYSQL='which mysql' >> >> if [ $# -ne 4 ] >> then >> echo "Usage: mtest4 empid lastname firstname salary" >> else >> statement="insert into employees values ($1, '$2','$3', $4)" >> $MYSQL test<< EOF >> $statement >> EOF >> If [ $? -eq 0 ] >> then >> echo "Data successfully added" >> else >> echo "Problem adding data" >> fi >> fi >> >> >> and here is the error I get: >> >> [Bobster at localhost ~]$ ./mtest4 5 Johnson John 120000 >> ./mtest4: line 15: syntax error near unexpected token `then' >> ./mtest4: line 15: ` then' >> >> Thanks in advance for any inputs. > The If on line 14 should be if (lowercase). > Hey that was the fix.. [Bobster at localhost ~]$ ./mtest4 5 Johnson John 120000 /usr/bin/mysql /usr/bin/test Data successfully added Thanks Les! Bob