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

Re: finding symlinks without target



In message <980123080024.ZM16631@xxxxxxxxxxxxxxxxxxxxxxx>, "Bart Schaefer" writ
es:
 >	file **/*(D@) | fgrep broken
 >
 >(You may need to change the grep if you're not using GNU `file`.)
 >
 >Oh, you want it all in zsh?
 >
 >	for i in **/*(D@); [[ -f $i || -d $i ]] || echo $i
 >
 >But I think the pipe to fgrep would be faster.  (Why isn't there a glob
 >qualifier to chase links?  **/*(@^.,@^/) would appear to be perfect, but
 >doesn't work.)

You could also implement it as a function with perl:

badsyms () {
    perl -e '{
        require "find.pl";
        sub wanted { !stat($_) && print("$name\n") }
        &find(@ARGV);
    }' $*
}

However, this seems a bit slower than M. Schaefer's solutions above.

Peter Williams <peter.williams@xxxxxxxxxxxx>

------------------ SITUATION: New Account Creation -------------------
ADMINISTRATIVE FASCIST:  Puts new account policy in motd.  Since
  people without accounts cannot read the motd, nobody ever fulfills
  the bureaucratic requirements; and so, no new accounts are ever
  created.
  -- Stephan Zielinski, "KNOW YOUR UNIX SYSTEM ADMINISTRATOR"



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