in reply to [OT] 'perl' is not the 'perl' reported by 'which perl'
I assume that I have a POSIX-conformant shell:DESCRIPTION which returns the pathnames of the files (or links) which would be exe +- cuted in the current environment, had its arguments been given as com +- mands in a strictly POSIX-conformant shell. It does this by searchin +g the PATH for executable files matching the names of the arguments. I +t does not canonicalize path names.
I don't know what "It does not canonicalize path names" means. Is that relevant to this issue ?$ echo $SHELL /bin/bash
The only thing happening that's "wrong" is that final output. Everything else is sane and as expected.$ echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/game +s:/usr/local/games:/snap/bin $ which perl /usr/bin/perl $ perl -le 'print $];' 5.026001 $ /usr/bin/perl -le 'print $];' 5.026001 # Select another perl, and hide the # perl executable by renaming it $ mv ~/perl528-d/bin/perl ~/perl528-d/bin/perl_hide # Prepend the location of that # "hidden" perl to $PATH $ export PATH=~/perl528-d/bin:$PATH # That change to $PATH clears the cache, # so run a perl command that will again # set the cached perl to /usr/bin/perl. # The problem does not arise if this # step is omitted. $ perl -le 'print $];' 5.026001 # Make the hidden perl visible again $ mv ~/perl528-d/bin/perl_hide ~/perl528-d/bin/perl $ which perl /home/sisyphus/perl528-d/bin/perl $ /home/sisyphus/perl528-d/bin/perl -le 'print $];' 5.028000 $ perl -le 'print $];' 5.026001
But I doubt that needed to be demonstrated, anyway ;-)$ perl -le 'print $];' 5.026001 $ export PATH=~/nonexistent:$PATH $ perl -le 'print $];' 5.028000
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: [OT] 'perl' is not the 'perl' reported by 'which perl'
by LanX (Saint) on Aug 22, 2020 at 14:23 UTC | |
Re^2: [OT] 'perl' is not the 'perl' reported by 'which perl'
by Anonymous Monk on Aug 22, 2020 at 07:40 UTC | |
by syphilis (Archbishop) on Aug 22, 2020 at 11:38 UTC |