I've this BATCH script to run from my korn script...
The command is
/usr/local/BATCH/runBatch.sh PARAM1 'PARAM2 -PARAM21 PARAM22'
(runBatch takes
parameter 1 = PARAM1
parameter 2 = 'PARAM2 -PARAM21 PARAM22'
)
If i run this command from command line it just runs fine...
But if i call it from my script ( using ksh )
(runbatch takes
parameter 1 = PARAM1
parameter 2 = 'PARAM2
parameter 3 = -PARAM21
parameter 4 = PARAM22'
)
Any idea guys?
what i found is kshell does not handle '' so well as in parameters....any thing on this would appreciate !!!
g.pi
July 22, 2009, 10:51am
2
I would not say that ksh does not handle params well, just because of a issue you faced. I have not experienced any issues in this regard.
You can try this.. Call runBatch.sh from your script, as follows:
/usr/local/BATCH/runBatch.sh $1 "$2"
Hope this works for you.
I've tried /usr/local/BATCH/runBatch.sh $1 "$2"
but still it does not work ...
Please make one script which handles parameters like i said ...
parameter 1 = PARAM1
parameter 2 = 'PARAM2 -PARAM21 PARAM22'
and write another ksh script and try kicking it off... i know it's not issue but trying to find out what's wrong ... Can not use any other shell than "ksh"
Appreciate your time ..
g.pi
July 22, 2009, 12:05pm
4
prash184u, I don't see the problem. Here is what I have:
main.sh:
#!/bin/ksh
echo "PARM1=$1"
echo "PARM2=$2"
echo "Invoking runBatch.sh"
runBatch.sh $1 "$2"
runBatch.sh:
#!/bin/ksh
echo
echo "In runBatch.sh"
echo "PARM1=$1"
echo "PARM2=$2"
I am invoking main.sh as follows:
main.sh PARAM1 "PARAM2 -PARAM21 PARAM22"
And the output is:
PARM1=PARAM1
PARM2=PARAM2 -PARAM21 PARAM22
Invoking runBatch.sh
In runBatch.sh
PARM1=PARAM1
PARM2=PARAM2 -PARAM21 PARAM22
Aren't you seeing a similar output?
kshji
July 22, 2009, 12:30pm
5
You have not published your script, easier to give comments.
If you call any posix-sh, even bsh (sh, ksh, bash, ..) like:
./script arg1 "arg2 is something- ex. $LOGNAME" 'arg3 is more'
And script is:
#!/bin/sh
#!/bin/ksh
#...
arg1="$1"
arg2="$2"
arg3="$3"
echo "arg1 = <$arg1>"
echo "arg2 = <$arg2>"
echo "arg3 = <$arg3>"
# now you can call some command
# put your variable insite " ". Why ? If your variable include argument delimeter,
# then shell will use it. With " " you tell - parse only variable, $() and \, nothing else.
#
somecmd "$arg1" "$arg2" "$arg3"
Thanks g.pi,
Can you please quickly make one change here
main.sh
-------------------------
#!/bin/ksh
PARM1=PARAMETER1
PARM2="PARAMETER2 -PARAMETER21 PARAMETER22"
echo "Invoking runBatch.sh"
runBatch.sh $1 "$2"
--------------------------
and please call main.sh simply without any parameters ...
g.pi
July 22, 2009, 1:32pm
7
Prash184u, that also works fine for me. Only correction that I had to make was to invoke runBatch.sh with $PARM1 and "$PARM2", instead of $1 and $2.
I hope kshji's example above, explains why you are seeing unexpected results.
Thank you again to all ...
I still have the problem but i will have to concentrate on other things now ... later when i will find and fix the problem i will post it out ...