On 27/10/2019 14:51, Robert Elz wrote:
While the subject of this message refers to 7-TC1, the page/line numbers
below refer to 7-TC2.
If it hasn't already happened in some other issue/bug report that
I'm unaware of, could we do the same thing as was done for "nolog"
to the absurd -h option?
I have no idea if it is implemented anywhere, I find it hard to
imagine how - I'm not even really sure what it means, the sole
description (lines 77147-8 on page 2410 (in XCU 2.14, the "set"
special builtin page) doesn't actually give much of a clue as to
what it really is intended to accomplish.
In bosh:
set -h
type ls
f() { ls; }
type ls
will print
ls is /bin/ls
ls is hashed (/bin/ls)
This could potentially be useful if the script author knows the command
will be executed in multiple subshells, but never in the parent shell.
It ensures the command is only looked up once, rather than once per
subshell.
(The way it is implemented does not strictly match POSIX or its own
documentation, as the hashing occurs when function definitions are
parsed, rather than when functions are actually defined.)
If you think you know what -h does, please speak up - obviously it
affects functions, so if you can explain it, please consider how
it works with the following function (which has for the purposes of
this e-mail has no err checking):
Your examples modify PATH. All modifications to PATH cause all
previously remembered locations of commands to be forgotten, including
those found through function definitions.
Cheers,
Harald van Dijk