On 20/08/2021 16:31, Roberto A. Foglietta wrote:
Il giorno ven 20 ago 2021 alle ore 16:36 Harald van Dijk
<[email protected] <mailto:[email protected]>> ha scritto:
cat >shrc <<EOF
:
:
:
EOF
ENV=shrc ./busybox ash -ic 'echo LINENO=$LINENO'
3
I can understand (and would
personally prefer) outputting 1 / 2 for the first case and 1 for the
second case. Outputting 3 for the second case seems wrong.
Please Harald, explain to me the syntax of this case because it is
unusual for me.
Especially what's supposed to do ENV=shrc in these conditions. Thank you.
Do you agree that this is a rare corner case?
When an interactive shell is invoked with the ENV variable defined,
the file referenced by the ENV variable is read and executed as the
first step. This is roughly equivalent to bash's ~/.bashrc, except
without a hardcoded location. Since busybox ash doesn't process
~/.bashrc or any fixed-name rcfile, specifying an rcfile using the ENV
variable is the only way to achieve the same results. Having an ENV
variable set in the environment is not a corner case, that is quite
normal when using a shell such as busybox ash interactively. Normally it
would already be part of the environment and not specified explicitly in
the invocation of another shell, but how ENV is set does not make a
difference to how busybox processes it.
Using -i in combination with -c is probably uncommon though. I do not
know how uncommon, it might just be slightly uncommon, or it might be
exceedingly rare.
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox