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

Re: globbing on symlink target



On Wed, Feb 28, 2018 at 7:42 PM, Eitan Adler <lists@xxxxxxxxxxxxxx> wrote:
> Is it possible to glob on a symlink target rather than the symlink
> name. For example I have several symlinks that *point to* filenames of
> the form ABX.rb but themselves have no pattern to match on. I could
> write a loop and use readlink but would prefer to use glob syntax for
> interactive use.

% ls -l *(@)
lrwxrwxrwx 1 mikaelh users 3 Feb 28 16:50 broken -> foo
lrwxrwxrwx 1 mikaelh users 3 Feb 28 20:27 broken2 -> bar
lrwxrwxrwx 1 mikaelh users 3 Feb 28 20:27 hello -> foo
% echo *(e*'local -A foo; zstat -LH foo $REPLY; [[ $foo[link] == foo ]]'*)
broken hello

It is arguable if this is interactive use syntax. You could write a
wrapper function but then you need to quote foo (again).

-- 
Mikael Magnusson



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