On 7/30/14, 8:18 PM, Linda Walsh wrote: > Was comparing /contrasting output of "which" with output of "type -[pPa]" > (trying all 3) with the intent of being able to turn which into an alias, > since > it returned incorrect info for "builtins, aliases and functions" -- because > it is a separate program. > > While "which" returns "not found in path when I turn off the exec > bits for "echo", bash still returns the first copy of the file in my > path -- executable or not.
No: $ ../bash-4.3-patched/bash ./x25 4.3.22(16)-release PATH = /usr/bin:/bin:/usr/local/bin -rw------- 1 root wheel 14128 Jul 31 09:12 /usr/bin/echo /bin/echo -rwxr-xr-x 1 root wheel 14128 Apr 8 16:15 /bin/echo $ cat ./x25 echo $BASH_VERSION PATH=/usr/bin:/bin:/usr/local/bin echo PATH = $PATH ls -l /usr/bin/echo type -P echo ls -l $(type -P echo) If you already have `echo' in the command hash table, type -P will return it, since that's what the shell will attempt to execute. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/