Liste des Groupes | Revenir à cu shell |
On 24.01.2025 23:00, Keith Thompson wrote:Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:>On 24.01.2025 14:46, Dan Cross wrote:[...]
/usr/bin/which is limited in what it can do. It follows POSIX-specified
behavior for $PATH; it doesn't recognize any shell-specific rules. [...]
Sure.
>[...]>The settings PATH=~/bin and PATH="~/bin" respectively shall
result in the same behavior across shells when searching for
programs; in the first case looking into "/home/someuser/bin/"
and in the second case looking into "./~/bin/" (i.e. a path
component with a local directory named "~").
What do you mean by "shall result?
I mean that a shell should behave consistently. (I think Bash does
not in the given case.)
All shells that conform to POSIX behave as you describe. bash doesn't
conform to POSIX unless you ask it to. Neither do csh, tcsh, and fish.
We were speaking about shell programming, so [seriously] I don't
consider Csh and Tcsh as sensible sample shells for the discussion.
(Thinking about it, I wonder whether Bash inherited tilde-handling
from Csh, maybe; that would at least explain something.)
(I don't know Fish, so I cannot comment on that.)
[...]>BTW, it hadn't occurred to me that you can have a relative path in a>
component of $PATH, but it does seem to work. I won't be taking
advantage of this information.
Yes. Some prefer to add '.' to PATH. (Though I have no intention
to discuss that habit.)
Les messages affichés proviennent d'usenet.