bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug? "type -P xxx" returns "xxx" that isn't executable...(or readabl


From: Chet Ramey
Subject: Re: bug? "type -P xxx" returns "xxx" that isn't executable...(or readable)
Date: Thu, 31 Jul 2014 09:19:18 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.6.0

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    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]