[**EXTERNAL**] Re: [PATCH] ash: make bash_source command search current directory after PATH

Paul Otto paul at ottoops.com
Fri Jan 26 18:24:14 UTC 2018


On Fri, Jan 26, 2018 at 10:47 AM, Cathey, Jim <jcathey at ciena.com> wrote:

> My understanding, from years past, is that "source <file>" (or ". <file>")
> is _exactly_ the same as "<file>", except that it's running in _this_ shell
> rather than in a subshell.  Thus it is able to affect environment variables
> that subsequent commands can inherit, etc.
>
> If "." is not in your PATH, and you want to source a file that's right
> there, you have to ". ./<file>" just as you'd expect.  If that's not what
> bash is doing, then it's wrong.
>
> -- Jim
>
>
Your understanding regarding how ". filename" / "source filename" is
supposed to execute commands in the file is correct, it reads and executes
commands in the *current shell* as opposed to how "./filename" runs a
script as an executable file by launching a *new shell*.

Regarding your last statement though, just because BASH doesn't adhere to
POSIX does not make it "wrong". This is particularly true when it comes to
a tool intended to emulate another tool - to change from the expected
behavior because it is believed to be "wrong" results in a tool which
incorrectly emulates BASH. BASH does many non-POSIX compliant things. It
works exactly as documented.

- Paul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20180126/872233b6/attachment.html>


More information about the busybox mailing list