Possibly an invisible character. Delete the entire line with "then" and re-type it. That error seems odd. On Wed, May 4, 2011 at 12:33 AM, Robert <bobster58@xxxxxxxxx> 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@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. > > Bobster > > > > _______________________________________________ > CentOS mailing list > CentOS@xxxxxxxxxx > http://lists.centos.org/mailman/listinfo/centos > -- Steven Crothers steven.crothers@xxxxxxxxx _______________________________________________ CentOS mailing list CentOS@xxxxxxxxxx http://lists.centos.org/mailman/listinfo/centos