Bash Posix Compliance
- From: "gundsawada" <rajivrnair@xxxxxxxxx>
- Date: 29 May 2006 21:17:27 -0700
Hi
Another day, another problem. I have the following shell script :
NOTE : SERVERIP is an env variable. This is a comma-separated
ip-address:port combination like x.x.x.x:y,x.x.x.x:y,x.x.x.x:y
----------------------------------------------------------------------------------------------------------------------------
#!/bin/sh
# Determine the number of servers
SERVER_COUNT=`echo $SERVERIP | tr ',' '\012' | wc -l | cut -d ' ' -f8`
echo "Server Count : $SERVER_COUNT"
# For each server, get the ip address and port
for ((index = 1 ; index <= $SERVER_COUNT ; index++))
do
# Get the port and IP address of each server
SERVER=`echo $SERVERIP | cut -d',' -f$index`
done
----------------------------------------------------------------------------------------------------------------------------
When i run this script like so...
$ . servers.sh
this works fine. However, If I use the sh -x command ($ sh -x
servers.sh), I get the following error:
+ echo
+ tr , \012
+ wc -l
+ cut -d -f8
SERVER_COUNT=1
+ echo Server Count : 1
Server Count : 1
servers.sh: syntax error at line 9: `(' unexpected
I've also tried changing the first line to #!/bin/bash but I get the
same error. This is on Solaris 5.9. Can anyone help?
Thanks in advance,
Rajiv
.
- Follow-Ups:
- Re: Bash Posix Compliance
- From: Stephane CHAZELAS
- Re: Bash Posix Compliance
- Prev by Date: Re: Shell question
- Next by Date: Re: Bash Posix Compliance
- Previous by thread: Shell question
- Next by thread: Re: Bash Posix Compliance
- Index(es):
Relevant Pages
|
|