Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to fix error msg: unknown test operator

Status
Not open for further replies.

6656

Programmer
Nov 5, 2002
104
US
Hi all,

If I give multiple positional parms to a ksh script, I will get a error msg 'unknown test operator'. For example:

$> my_script_name A101 B101 B103
My script can work OK with capture $1 $2 $3 values.

But how fix it without error msg 'unknown test operator'.

Thanks,
Mike

 
Hi Mike,

My guess is that somewhere in the script my_script_name there is a mis-constructed test or if statement that is dependent on some or all of the input parameters. Please post your script or the relevant part of it, for further help.

I hope that helps.

Mike
 
Hi Mike,

Here is a test script.

-------- my_script_name --------
#!/usr/bin/ksh

for parm in $*
do
echo " this is parm = $parm ."
done
;;

exit 0
---------------------------------------

Thanks,
Mike
 
Get rid of ;;


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks Mark and PHV,

I have found the error in my script.

if [ x$* = x ]; then .... This causes error while more than one parameters provided.

Add quote around the values can fixes the error.
if [ "x$*" = "x" ]; then ....
 
Why not simply test $# ?
Anyway posting the real code raising the error would make the solving faster.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top