Hello, I am getting a syntax error with a shell script of mine that is eluding me...I am pretty new to this so if someone could help me out I'd appreciate it. Here is the part of the script that is throwing the error:
#!/bin/ksh
# Kismet/PCX Loader
#
.
.
.
set count = 0
set stat = 1
# while output pipe cannot be opened, keep trying to open it. stop after 10 seconds (5 tries)
# run the two concurrently
# /root/kismet-2004-04-R1/kismet_server
# kismet_server & bash ; cd /home/bang/dev/3.x/rtpcx/bin/x86_og/
(kismet_server) &
(
cd /home/bang/dev/3.x/rtpcx/bin/x86_og/
while [ $stat -gt 0 ]
do
# echo "+++++ GOT IN HERE +++++"
set stat = ./pcx /tmp/kismet_dump $1
# wait for 4 seconds
sleep 4
set count = 'expr $count + 1'
if [ $count -eq 5 ]; then
echo "ERROR: could not open Kismet output pipe."
break
else
if [ $count -ne 1 ]; then
echo "retrying Kismet output pipe..."
else
echo "opening Kismet output pipe..."
fi
fi
done
) # <--- *** ERROR OCCURS HERE, COMPLAINS ABOUT ")" ***
wait
.
.
.
It complains about the closing ) after the while loop.
The exact error is:
"./wireless_pcx_shell[33]: [: 0: unexpected operator/operand"
Is there something that I am doing wrong here? Any help would be great, thanks everyone.