![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| tar the symbolic link | ganga.dharan | Shell Programming and Scripting | 1 | 05-23-2008 08:11 AM |
| Shell Command for Symbolic Link Targets | bdizenhouse | UNIX for Dummies Questions & Answers | 3 | 02-21-2008 01:57 PM |
| need some info about symbolic link and hard link | detective linux | UNIX for Dummies Questions & Answers | 2 | 01-08-2008 07:36 AM |
| [help] about symbolic link solaris 8 | bucci | SUN Solaris | 1 | 10-12-2006 07:30 AM |
| symbolic Link | bhargav | UNIX for Dummies Questions & Answers | 1 | 10-15-2004 10:41 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Shell Command for Symbolic Link Targets (Posted in Unix for dummies as well)
**DUP post in Unix for dummies questions & answers***
Hello, I'm trying to create a script to do the following: 1. Find all symbolic links that are not set up using absolute pathnames 2. Find all symbolic links that are broken (ie, target does not exist). I would like each of these to be executed as a single command, as well as a duplicate command that will display the count of resulting matches. I have done the following: #2 find / -type l | (while read FN ; do test -e "$FN" || ls -l "$FN"; done) and find / -type l | (while read FN ; do test -e "$FN" || ls -l "$FN"; done) | grep -c '[a-z]' #1 find / -type l | (while read FN ; do test -e "$FN" | file -h "$FN" | grep 'symbolic link to [^/]' ; done) and find / -type l | (while read FN ; do test -e "$FN" | file -h "$FN" | grep 'symbolic link to [^/]' ; done) | grep -c 'symbolic link to [^/]' Are these correct? I want to make sure I'm only looking at local filesystems only. Also how can I suppress the messages like "ls: 0653-341 The file xxx does not exist." or "find: 0652-019 The status on xxx is not valid." Thanks for any and all help. Ben |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|