Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: listing all executables matching 'foo'



Sven Guckes écrivait :
> Apropos:
> 
> _listall () {
>    if [[ $# = 0 ]]
>    then
>      echo "Usage:    $0 program"
>      echo "Example:  $0 zsh"
>      echo "Lists all occurrences of program in the current PATH."
>    else
>      for program in `which -a $1`
>      do
>        ls -lL $program
>      done
>    fi
> }
> 
> Comments?

Gives strange things with aliases and functions :

% which -a which
which: aliased to which -a
which: shell built-in command
/bin/which
/usr/bin/which
% _listall which  
ls: which:: No such file or directory
ls: aliased: No such file or directory
ls: to: No such file or directory
ls: which: No such file or directory
total 4
drwx------   2 canon    pampa         512 Aug 25 16:21 .
drwx------   5 canon    pampa        2560 Aug 25 16:21 ..
ls: which:: No such file or directory
ls: shell: No such file or directory
ls: built-in: No such file or directory
ls: command: No such file or directory
-r-xr-xr-x   1 bin      bin          1155 Oct 25  1995 /bin/which
-r-xr-xr-x   1 bin      bin          1155 Oct 25  1995 /usr/bin/which


-- 
Hubert Canon



Messages sorted by: Reverse Date, Date, Thread, Author