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

How to resolve a symlink's to its non-existing destination?



When I use :a, :A or :P on a symlink whose destination does not exist, I do not get the output I'm expecting:

% touch foo
% ln -s foo bar
% print bar(:P)
/private/var/folders/hk/lcsr76092ygbtc8y1fryg7jh0000gn/T/tmp.ir6Iuz7K/foo
% rm foo
% print bar(:P)
/private/var/folders/hk/lcsr76092ygbtc8y1fryg7jh0000gn/T/tmp.ir6Iuz7K/bar

How can I consistently resolve a symlink's destination, regardless of whether it exists?

I know I can use readlink for this, but is there any way to do this with Zsh?



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