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

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



On 2013-08-18 at 04:40 +0200, 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?

The not-specific-to-zsh bit:

  $ ls -Lld etcetera

The -L says to chase the symlink when given on the command-line.  You
then want -d to not list the contents of the directory, only the
directory itself.

The options require vary by command used.

For the zsh "zstat" module-provided builtin, "zstat -L" will give you a
"link" field.

  % zstat -L +link etcetera 
  /etc

-Phil



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