bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: last `set option value' always passed as $1 and $2 during a 'source'


From: Philip Lijnzaad
Subject: Re: last `set option value' always passed as $1 and $2 during a 'source' ??
Date: 11 Jun 2001 17:40:24 +0100

> Philip Lijnzaad <lijnzaad@ebi.ac.uk> writes:
>> In fact, if you
>> 
>> set foo bar
>> 
>> , this will result in $1 being 'foo' and $2 being 'bar' when doing a
>> source somefile. So readline is irrelevant, and my question remains. 

> man bash:
>        source filename [arguments]
>               ...  If any arguments are supplied, they become the
>               positional parameters when filename is executed.

which I don't ... 

>               Otherwise the positional parameters are unchanged.

... which I didn't know I did, but now that I look at it I seem to have set: 

echo $1: foo 
echo $2: bar

So the question now is: why does ``set foo bar'' change $1 and $2 ? Is this
documented? If so, where ? More importantly, why? It renders the passing of
parameters to source'd scripts unusable, since you can't distinguish between
parameters that happen to come from the calling environment, and those passed
in as arguments from the the ``source script args'' invocation.  Puzzled,

                                                                       Philip
-- 
If you have a procedure with 10 parameters, you probably missed some. (Kraulis)
-----------------------------------------------------------------------------
Philip Lijnzaad, lijnzaad@ebi.ac.uk \ European Bioinformatics Institute,rm A2-08
+44 (0)1223 49 4639                 / Wellcome Trust Genome Campus, Hinxton
+44 (0)1223 49 4468 (fax)           \ Cambridgeshire CB10 1SD,  GREAT BRITAIN




reply via email to

[Prev in Thread] Current Thread [Next in Thread]