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

Re: Testing for broken symlinks



>>>>> "Peter" == Peter Stephenson <pws@xxxxxxx> writes:

    Eric>> Is there any way to test if a symlink is broken?

    Peter> This will work:

    Peter> broken=(mylinktest(N-@))

    Peter> if (( ${#broken} )); then
    Peter> print mylinktest is a broken symbolic link
    Peter> else
    Peter> print mylinktest is not a symbolic link or is not broken
    Peter> fi
    Peter> <snip>

A off-topic question, what ever happen to the old feature (some
eariler version of zsh) that displays an '&' at end of the bad symlink
when displaying filename completion lists?  e.g.,

   > touch foo1 foo2
   > ln -s not-exist foo3
   > ls foo<tab>
   foo1@   foo2@   foo3&



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