Re: error: unary operator expected



-----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-----
.



Relevant Pages

  • Re: very simple if question I cant find in book
    ... echo "got a c file" ... I need to know if $file has suffix .c or .cpp ... Enterprise Technology Solutions, TD Bank Financial Group ... Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org ...
    (comp.unix.shell)
  • Re: find command
    ... i am trying to accomplish is; ... files keep arriving ... Enterprise Technology Solutions, TD Bank Financial Group ... Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org ...
    (comp.unix.shell)
  • Re: How to determine user name from within C++ on linux
    ... we want to create a temp directory for the current ... Depending on your porgam, this may be more or less difficult. ... Enterprise Technology Solutions, TD Bank Financial Group ... Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org ...
    (comp.os.linux.development.apps)
  • Re: Linux/unix Shell
    ... used telnet or Putty to login to my unix development machine and get ... putty/telent but give me multiple shell/consoles. ... Enterprise Technology Solutions, TD Bank Financial Group ... Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org ...
    (comp.os.linux.development.system)
  • Re: Source Code to Plaugers "Standard C Library"
    ... I find a lot of references for the ... but not the actual source code from the book. ... Enterprise Technology Solutions, TD Bank Financial Group ... Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org ...
    (comp.lang.c)