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

Re: Dereferencing a symlink...or that alike...



On Aug 18,  4:40am, meino.cramer@xxxxxx wrote:
}
} suppose I have the following symlink in my $HOME
} 
}     etcetera -> /etc
} 
} . Is there a way to get back "/etc" only (not the contents
} of /etc/. nor "etcetera") when doing a 'ls' or such?

Depends on what is covered by "or such" ...

    % zmodload zsh/stat
    % zstat +link etcetera
    /etc

However, that prints nothing if the file is not a symbolic link.

I don't know of any external utility that will print *only* the target
of the symlink.  E.g.

    % /usr/bin/stat --format=%N etcetera
    'etcetera' -> '/etc'



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