0: #!/bin/sh
1: # For people who eat megabytes like corn chips..
2: #
3: # Inspired by overflowing partitions and the pretty shell
4: # code in Tales from the Abyss: UNIX File Recovery (SysAdmin
5: # Mag) at http://www.samag.com/documents/s=1441/sam0111b/0111b.htm
6: # You can also do things in shell like:
7: # for i in `find . `; do file $i | grep ASCII ; done
8: # Or replace $1 with a directory and paste from "find" at prompt.
9: # No need to shy away from the command line! read man bash
10: # (or man tcsh) and get results fast.
11: #
12: echo "Recursive search for symbolic links. Usage: findlinks dirname";
13: find $1 | file -f - | grep link\ to | awk -F: '{print $2 "\t" $1}' | sort -b +1 | perl -e '
14: $sy = "symbolic link"; $sb = "broken symbol"; $sl = length($sy);
15: while (<>) {
16: $m=$_; $m =~ s/^\s+//;
17: $n = $m;
18: $n =~ s/^(.+)\t(.+)$/$2\t\($1\)/; #WAS $n =~ s/^(.+)\t(.+)$/$2/;
19: if (substr($m,0,$sl) eq $sy) {push @sys,$n;}
20: elsif (substr($m,0,$sl) eq $sb) {push @sbs,$n;}
21: else {push @oth,$n;} #for debug
22: }
23: print "\n** Symbolic Links:\n", @sys, "\n** Broken Symbolic Links:\n", @sbs;
24: print "\nOthers:\n", @oth unless $#oth<0;
25: '
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.