Re: [CentOS] Syntax Help on a Bash Script

2011-05-04 Thread Robert
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 scrip

Re: [CentOS] Syntax Help on a Bash Script

2011-05-03 Thread Les Mikesell
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 M

Re: [CentOS] Syntax Help on a Bash Script

2011-05-03 Thread John R. Dennison
On Tue, May 03, 2011 at 11:33:52PM -0500, Robert wrote: > > #!/bin/bash > # send data to the table in the MySQL database > > MYSQL='which mysql' You want "MYSQL=$(which mysql)" > If [ $? -eq 0 ] > then >echo "Data successfully added" > else >echo "Probl

Re: [CentOS] Syntax Help on a Bash Script

2011-05-03 Thread Robert
Thanks for the help thus far. Have tried recommendations on the error line and still am getting the error. Oh well, its late so I'm going to stop trying tonight and will take this up again in the AM. Bob On 05/03/2011 11:49 PM, Andrew Harley wrote: > On Tue, 2011-05-03 at 23:33 -0500, Robert

Re: [CentOS] Syntax Help on a Bash Script

2011-05-03 Thread Andrew Harley
On Tue, 2011-05-03 at 23:33 -0500, Robert wrote: > MYSQL='which mysql' Also this line should use either backticks or $() command substitution instead: For example: [andrew@savoy ~]$ MYSQL='which mysql' [andrew@savoy ~]$ echo $MYSQL which mysql [andrew@savoy ~]$ MYSQL=$(which mysql) [andrew@savoy

Re: [CentOS] Syntax Help on a Bash Script

2011-05-03 Thread Andrew Harley
On Wed, 2011-05-04 at 00:36 -0400, Steven Crothers wrote: > Possibly an invisible character. Delete the entire line with "then" > and re-type it. That error seems odd. > Or could change to: if [ $? -eq 0 ];then -- Andy ___ CentOS mailing list CentOS

Re: [CentOS] Syntax Help on a Bash Script

2011-05-03 Thread Steven Crothers
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 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 worki