[Toybox] hostname vs ${x at P}

Rob Landley rob at landley.net
Thu Sep 24 22:48:06 UTC 2026


On 9/21/26 07:52, Chet Ramey via Toybox wrote:
> On 9/19/26 7:10 PM, Rob Landley wrote:
>> How do I reset what bash thinks the hostname is?
> 
> You don't. Bash fetches the hostname at startup and uses it. It's very
> uncommon for the hostname to change while bash is running; if you want
> to accommodate something like that and pick up a new hostname for some
> reason, use `exec bash'.

Did I ever ask why this happens?

$ env -i bash --noprofile --norc -c env
PWD=/home/landley/toybox/clean
SHLVL=0
_=/usr/bin/env
$ env -i bash --noprofile --norc -c $'env\n\n'
PWD=/home/landley/toybox/clean
SHLVL=1
_=/usr/bin/env

It's testing the default exports, but without the two newlines in -c 
bash says SHLVL=0. (I'm going through sorting old tests into a more 
coherent order to see what I'm not testing yet, and... why?)

Rob

P.S. Yes, TWO newlines. Which is odd because in theory it hasn't read 
the second one yet when it runs "env", and yet...


More information about the Toybox mailing list