Re: Can $1 be set in a script?



On Thu, 30 Mar 2006 15:46:02 -0500, "Chris F.A. Johnson"
On 2006-03-30, larryalk wrote:

Can $1 be set to something else in a script?
set -- teststring "$@" ## "$@" adds existing positional parameters

Chris I apologize because I didn't see how your 'set' line worked.
I thought the 'set ' would just give me a single string instead of
parsing the command line parameters into $1 $2 etc.

When I tested it worked perfectly:

I made a little executable and found that
set "$@"
echo $1 $2
gave me:

testprog one two three
testprog: one two

That's the answer I needed.
Sorry I didn't see it the first time.

or
$1=$($2)

Is that what you want? to put the output from a command in $2 into
$1?

set -- "$($2)"

What does the double dash do?

Larry


--
My real sig is much better.
.



Relevant Pages

  • Re: CLIL source code from book "Firmware demystified"
    ... > ??>> parsing it, than calls appropriate function (for example, which shows ... > ??>> function (assuming that in CLI prompt you enter some arguments, ... > L> - main function getting command line from user? ... > 'argc' and 'argv' are valid only with a program running, ...
    (comp.arch.embedded)
  • Re: rpmbuild and whitespace in path names
    ... | directory/file name well. ... think about how you enter a command: ... However, things get hinky when adding arguements, or parsing remotely. ... quotations going to end up and what are the parsing rules? ...
    (Fedora)
  • Re: Cant get DOS "for" loop to return full filenames with spaces
    ... I'm trying to set up a DOS batch file to decode all the MP3 ... how to get the "for" command to return anything beyond the first ... Another problem is parsing. ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: file Error
    ... I am parsing an xml file,and using raw_input command to ask the ... program in production. ...
    (comp.lang.python)
  • Re: DOS Options
    ... it look like it's back to the drawing board when I get to the ... It never occurred to me that command line parsing ... not meaning to imply that my memory was faultless. ...
    (comp.lang.ada)