Red hat compatible

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

CentOS Version 5.3 (Final) Linux ubuntu 2.6.24-19-generi # 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

      

+2


source to share


3 answers


I have both Red Hat Enterprise Linux and CentOS boxes (I know they are the same)

That the script works the same for both of them for me, so I don't really 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

      

+2


source


CentOS == RedHat. Your question is meaningless. What versions of bash are you using? What result do you expect and what do you get instead?



0


source


CentOS! = RHEL. I don't see where your gap is, but both systems work for me and there are some differences, at least if you are using RHEL too. even some whole features are not present in CentOS which are in RHEL and I am having problems porting the script between them every time and then although the release and kernel match.

0


source







All Articles