tags:

views:

67

answers:

2

The following code works as expected on CentOS and Ubuntu O/s but not on Red hat. What changes needs to be made?

CentOS release 5.3 (Final) Linux ubuntu 2.6.24-19-generic #1 SMP Wed Jun 18 14:43:41 UTC 2008 i686 GNU/Linux

#!/bin/bash

depot=$1
table=$2
database=$3
combined="$depot$table"

if [ "$table" = 'routes' -o "$table" = 'other_routes' ]; then
echo 'first if successful'

elif [ "$table" = 'bus_stops' ]; then
echo 'elif successful'

else
echo 'else succsesful'

fi
A: 

CentOS == RedHat. Your question doesn't make sense. What versions of bash are you using? What output do you expect, and what do you get instead?

Roel
A: 

I've got both Red Hat Enterprise Linux and CentOS boxes here (I know they're the same thing)

That script works the same on both of them for me, so I really don't understand the OP's question.

-bash-3.2$ ./foo.bash foo other_routes
first if successful
-bash-3.2$ ./foo.bash foo routes
first if successful
-bash-3.2$ ./foo.bash foo bus_stops
elif successful
-bash-3.2$ ./foo.bash foo another
else succsesful
Glen