Eric "Shubes" wrote: > Eric "Shubes" wrote: >> Eric "Shubes" wrote: >>> David wrote: >>>> On Fri, 16 Feb 2007, Eric \Shubes\ wrote: >>>> >>>>> Here's a good Friday afternoon exercise for you script animals out there. >>>>> For example, >>>>> $ arglist="parm1 \"this is parm2\" parm3" >>>>> $ command $arglist >>>>> >>>>> command receives: >>>>> $?=5 $1=parm1, $2="this, $3=is $4=parm2" $5=parm3 >>>>> >>>>> What I want command to receive is: >>>>> $?=3 $1=parm1, $2=this is parm2, $3=parm3 >>>> Not sure if its the same, but the below worked. >>>> >>>> --------------- >>>> #!/bin/sh >>>> >>>> ls "${1}" >>>> ls "${2}" >>>> ls "${3}" >>>> ------------------- >>>> >>>> Invoked as: >>>> scriptname.sh "this is" a param >>>> >>>> resulted in: >>>> >>>> ls: this is: No such file or directory >>>> ls: a: No such file or directory >>>> ls: param: No such file or directory >>>> >>>> >>>> David >>> I wasn't quite clear enough I guess. Since I'm building a variable number of >>> parameters, I can't specify each one separately, and thus cannot use quotes >>> when invoking the command. >>> >>> Using your example, I need to do: >>> argument="this is" >>> scriptname.sh $argument a parm >>> and have it come out the same as your example. I can't put the whole thing >>> in quotes because I have a list of arguments, some containing spaces and >>> some not. >>> >>> >> Here's a simple example script: >> >> myfunc(){ >> echo "#=$#, 1=$1, 2=$2, 3=$3, 4=$4, 5=$5" >> } >> parm1=parm1 >> parm2="this is parm2" >> parm3=parm3 >> parm4="words for parm4" >> args="$parm1 $parm2 $parm3 $parm4" >> myfunc $parm1 "$parm2" $parm3 "$parm4" >> myfunc $args >> >> I need to invoke myfunc in the second manner and achieve the same result as >> the first invocation. >> > Dang! I think I found something. This works: > > parm1=parm1 > parm2="this is parm2" > parm3=parm3 > parm4="words for parm4" > args="$parm1 \"$parm2\" $parm3 \"$parm4\"" > myfunc $parm1 "$parm2" $parm3 "$parm4" > eval myfunc $args > > but when I tried it late last night (early morning, actually) I wasn't able > to get it to work. Must've been something else wrong with it. > > Let me plug this method into the real script, and I'll get back here. > > I still wasn't able to get it to work as I'd like to, but after looking further into dialog's man page, I see that these arguments can be passed as a (temp) file, so I'll go that route for now. I already had the file defined, but opted to use a environment variables instead to speed things up a bit. I don't think it'll be an issue, as there are other things being done that are a lot slower than simply reading the menu items from a file! Thanks for the help everyone. Have a great weekend, and be sure to stop by and see us at the Mesa Regal installfest tomorrow if you get a chance! -- -Eric 'shubes' --------------------------------------------------- PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us To subscribe, unsubscribe, or to change you mail settings: http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss