Re: error: unary operator expected
- From: Lew Pitcher <Lew.Pitcher@xxxxxxxxxxxxxxxx>
- Date: Thu, 18 May 2006 13:28:52 -0400
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Petterson Mikael wrote:
Hi,
When I execute my shell scrip below I get the following:
+ cc_started=false
+ CC_PATH=/home/eraonel/pub/cruisecontrol-bin-2.5
+ '[' -ne 0 ']'
./checkLocalCC.sh: line 8: [: -ne: unary operator expected
+ echo 'local installtion of cc is up and running [ ]'
local installtion of cc is up and running [ ]
What am I doing wrong here?
by the way line 8 is:
if [ $cc_exists -ne 0 ]; then
Tell me, what would the if statement expand to if the variable
$cc_exists is not set or is set to spaces or an empty value?
cheers,========
//mikael
script
======
#!/bin/sh
set -x
#find cruisecontrol process return 0 if found and non-zero if not
cc_exits=`ps -ef | grep CruiseControlWithJetty | grep -v grep`
Hmmm
cc_started=false==========
CC_PATH=$HOME/pub/cruisecontrol-bin-2.5
if [ $cc_exists -ne 0 ]; then
Hmmm^2
echo "local installtion of cc seems down. Trying to start!"
#try to start
while [ "$cc_started" = "false" ]
do
$CC_PATH/cruisecontrol.sh&
if [ $? -eq 0 ];then
$cc_started="true"
echo "Successfully restarted cc!"
else
echo "could not start cc! Retrying!!!"
fi
done
exit 0
else
echo "local installtion of cc is up and running [ $date ]"
fi
- --
Lew Pitcher, IT Specialist, Corporate Technology Solutions,
Enterprise Technology Solutions, TD Bank Financial Group
(Opinions expressed here are my own, not my employer's)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFEbK7UagVFX4UWr64RAvQCAJ0TJNJhJbaC3ePk3EGVyZm5L7MW2gCgyJha
wesqiNsDlGEgLtSgUYMlz20=
=4iQ8
-----END PGP SIGNATURE-----
.
- References:
- error: unary operator expected
- From: Petterson Mikael
- error: unary operator expected
- Prev by Date: error: unary operator expected
- Next by Date: Re: error: unary operator expected
- Previous by thread: error: unary operator expected
- Next by thread: Re: error: unary operator expected
- Index(es):
Relevant Pages
|