BashScripts.org
http://bashscripts.org/forum/

trying to fix [: 359: 11: unexpected operator
http://bashscripts.org/forum/viewtopic.php?f=15&t=1176
Page 1 of 1

Author:  prtc [ Wed Aug 25, 2010 1:00 pm ]
Post subject:  trying to fix [: 359: 11: unexpected operator

hello,

my knowledge of scripts is pretty basic.
i'm having problems running gridengine apparently because their startup script is somehow failing in my box (ubuntu 10.04) and i didn't get help from their forums.

when i source settings.sh i get:

[: 359: 11: unexpected operator
[: 359: 11: unexpected operator
[: 359: 11: unexpected operator
[: 359: 11: unexpected operator
[: 359: 11: unexpected operator
[: 359: 11: unexpected operator

here's the script:

SGE_ROOT=/share/sge/ge6.2u5; export SGE_ROOT

ARCH=`$SGE_ROOT/util/arch`
DEFAULTMANPATH=`$SGE_ROOT/util/arch -m`
MANTYPE=`$SGE_ROOT/util/arch -mt`

SGE_CELL=default; export SGE_CELL
SGE_CLUSTER_NAME=p6444; export SGE_CLUSTER_NAME
SGE_QMASTER_PORT=6444; export SGE_QMASTER_PORT
SGE_EXECD_PORT=6445; export SGE_EXECD_PORT

if [ "$MANPATH" = "" ]; then
MANPATH=$DEFAULTMANPATH
fi
MANPATH=$SGE_ROOT/$MANTYPE:$MANPATH; export MANPATH

PATH=$SGE_ROOT/bin/$ARCH:$PATH; export PATH
# library path setting required only for architectures where RUNPATH is not supported
case $ARCH in
sol*|lx*|hp11-64)
;;
*)
shlib_path_name=`$SGE_ROOT/util/arch -lib`
old_value=`eval echo '$'$shlib_path_name`
if [ x$old_value = x ]; then
eval $shlib_path_name=$SGE_ROOT/lib/$ARCH
else
eval $shlib_path_name=$SGE_ROOT/lib/$ARCH:$old_value
fi
export $shlib_path_name
unset shlib_path_name old_value
;;
esac
unset ARCH DEFAULTMANPATH MANTYPE

help please?
thx

Author:  Patsie [ Wed Aug 25, 2010 1:40 pm ]
Post subject:  Re: trying to fix [: 359: 11: unexpected operator

The default shell (/bin/sh) of Ubuntu used to be 'dash'. A nice shell just not as nice as 'bash'.
(you can check by doing an 'ls -l /bin/sh' in a terminal)
If your scripts starts with '#!/bin/sh' try changing it to '#!/bin/bash' instead and run the script again.
If it doesn't, just put it as the first line anyway :)
Or you can link '/bin/sh' to '/bin/bash' and make bash your default shell.
That used to be the root cause of a lot of my problems.

Author:  prtc [ Wed Aug 25, 2010 2:00 pm ]
Post subject:  Re: trying to fix [: 359: 11: unexpected operator

hey, thx for the quick reply. but i still get the same problem :(
i added #!/bin/bash to the first line and made chmod +x settings.sh to avoid source-ing it (not sure what the 'source' command does).
i still get:

$ ./settings.sh
[: 359: 11: unexpected operator
[: 359: 11: unexpected operator
[: 359: 11: unexpected operator
[: 359: 11: unexpected operator
[: 359: 11: unexpected operator
[: 359: 11: unexpected operator

Author:  prtc [ Wed Aug 25, 2010 2:07 pm ]
Post subject:  Re: trying to fix [: 359: 11: unexpected operator

an update: although i still get the error messages, at least now the PATHs are properly set and the basic gridengine commands will run. that's an improvement! :) should i still worry about the "[: 359: 11: unexpected operator" messages?

Author:  choroba [ Mon Aug 30, 2010 5:29 am ]
Post subject:  Re: trying to fix [: 359: 11: unexpected operator

prtc wrote:
an update: although i still get the error messages, at least now the PATHs are properly set and the basic gridengine commands will run. that's an improvement! :) should i still worry about the "[: 359: 11: unexpected operator" messages?

Yes, you should worry. The error is not reported by bash, I'd guess, at least my bash says "line 359" instead of just the line number. So, the error lies somewhere deeper in one of the called scripts, still interpreted by dash or some other shell.

Page 1 of 1 All times are UTC - 6 hours
© 2000, 2002, 2005, 2007 phpBB Group • http://www.phpbb.com