[ -e "foo" -o -L "foo" -a ! -e "foo" ]


it has no sense doing twice the "-e" test


$ ln -s nonexistent foo

$ [ -e "foo" -o -L "foo" -a ! -e "foo" ] && echo ok || echo ko
ok

$ [ -e "foo" -o -L "foo" ] && echo ok || echo ko
ok


as you can see, the first "-e" check imply the second one
(aka, if the first "-e" is false, necessarily the second one will be true...)


maybe you have "too rougly" join the trick to check a broken link

-L "foo" -a ! -e "foo"

but in this particular case you don't have to check "only" broken links, but every file, broken links included...

so every file but broken links is "-e"
links and broken links is "-L"

join together -e and -L
every file, included links and broken links

ok?
bye


Reply via email to