On Fri, Jan 26, 2018 at 10:47 AM, Cathey, Jim <jcat...@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
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to