Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
ttilt - Thanks for the stat command - wasn't aware of it.
However doing what you said on my system it returned the name of the link rather than the name of the file the link points to which is what I think mschutte was asking for.
A quick way to do it would be:
ls -l file |awk '{print $NF}'
The ls -l would show the file and its link - the awk would break the line up into fields (using whitespace as the delimiter) and the $NF would tell it to print the last field which would be the file to which the link is pointing.
You could create this as a function within your script to use it multiple times.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.