[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to print the target of a symbolic link?
From: |
Bob Proulx |
Subject: |
Re: How to print the target of a symbolic link? |
Date: |
Sat, 6 Mar 2010 22:15:57 -0700 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
Peng Yu wrote:
> 'ls -l' shows the symbolic link and its target. I could parse the
> output. But I'm wondering whether there is a convenient command that
> only print the target if it is a symbolic link otherwise print
> nothing? Thank you for your help.
See the 'readlink' command.
info coreutils 'readlink invocation'
`readlink' outputs the value of the given symbolic link. If
`readlink' is invoked with an argument other than the name of a
symbolic link, it produces no output and exits with a nonzero
exit code.
Also 'find' generally very useful for selecting files.
Bob