I have a script with works perfectly on SunOS machines with sh..
Here is a part of it which is not working on RedHat sh
config.sh
Code:
#!/bin/sh
..............
..............
# main
PATH=/usr/bin:/bin
export PATH
$HOSTNAME=`hostname`
while getopts t:a:D:w:r:h:p:i: name
do
case $name in
t) TYPE=$OPTARG;if [ "$TYPE" != "abc" -o "$TYPE" != "xy" ]
then
usage
elif [ "$TYPE" = "abc" ]
then
PORT=3546
PATH="/srv/temp/$HOST_NAME"
elif [ "$TYPE" = "xy" ]
then
PORT=7854
PATH="/srv/temp/$HOST_NAME-xy"
fi;;
a) INSTTYPE=$OPTARG;;
D) DN=$OPTARG;;
w) PASSWORD=$OPTARG;;
r) MAN=$OPTARG;;
h) HOST_NAME=$OPTARG;;
p) PORT=$OPTARG;;
i) PATH=$OPTARG;;
?) usage
;;
esac
done
usage function is defined elsewhere and works fine
Now when I call the program as
Code:
./config.sh -t abc -a all .......
the -a does not get registered and nor does -p and -i
When I do
Code:
./config.sh -a all -t abc -p 5478 -i /srv/asd/casd .......
the value of -a gets registered in $TYPE but then the values of -i and -p does not get stored..
this script is working fine on a SunOS machine.. but not on RHEL
What is going wrong here? I want the script to run as
Quote:
./config.sh -t xxx -a xxx .... (t first)
|
In SunOS the
Quote:
[ "$TYPE" != "abc" -o "$TYPE" != "xy" ]
|
is actually
Quote:
[ $TYPE -ne abc -o $TYPE -ne xy ]
|
This has been changed in RHEL to avoide some errors i was getting