[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: best way to test for empty dir?
From: |
Antonio Macchi |
Subject: |
Re: best way to test for empty dir? |
Date: |
Tue, 15 Dec 2009 16:05:55 +0100 |
User-agent: |
Mozilla-Thunderbird 2.0.0.19 (X11/20090103) |
[ -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
- Re: best way to test for empty dir?, (continued)
- Re: best way to test for empty dir?, Marc Herbert, 2009/12/14
- Re: best way to test for empty dir?, Matias A. Fonzo, 2009/12/14
- Re: best way to test for empty dir?, Andreas Schwab, 2009/12/15
- Re: best way to test for empty dir?, Matias A. Fonzo, 2009/12/15
- Re: best way to test for empty dir?, Andreas Schwab, 2009/12/15
- Re: best way to test for empty dir?, Matias A. Fonzo, 2009/12/15
- Message not available
- Re: best way to test for empty dir?,
Antonio Macchi <=
- Message not available
- Re: best way to test for empty dir?, Stephane CHAZELAS, 2009/12/12
- Re: best way to test for empty dir?, Stephane CHAZELAS, 2009/12/12
Message not available
Message not available