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: Paul Jarc
Subject: Re: last `set option value' always passed as $1 and $2 during a 'source' ??
Date: 12 Jun 2001 11:02:33 -0400
User-agent: Gnus/5.090004 (Oort Gnus v0.04) Emacs/20.7

Philip Lijnzaad <address@hidden> writes:
> The problem, BTW, does not exist as such in plain /bin/sh, since
> that won't pass arguments to a source'd (or should I say .-ed;-)
> script.

You still have the problem that you can't pass an empty argument list
to a sourced script without modifying the caller's list.  But with
traditional sh, that's just a special case of not being able to pass
*any* argument list without modifying the caller's.

>Paul> It certainly isn't unique to bash.  Solaris sh doesn't even let you
>Paul> pass arguments to the sourced script on the 'source' command line -
>Paul> the sourced script always sees the caller's positional parameters.
> 
> I thought this actually was the standard behaviour; ash and osf1 sh also have
> it like this. But after looking it turns out that sgi sh and ksh have it like
> bash, so I don't know. 

They all do 'set' the same, and they all do 'source' the same if you
don't pass extra arguments.  The extension here is being able to set
the positional parameters for a script by putting them on the 'source'
command line.  That extension is (apparently) not part of traditional
sh, though perhaps it is in a new version of some standard.


paul



reply via email to

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