t;$link" ] || unlink $link' but Jilles is definitely right
that simply using 'test -e' is the way to go.
Stephen, sorry to hear that the change in behavior to stat(1) was
troubling to you. A little bit of the history might be useful. I
originally imported stat(1) from NetBSD in
On Mon, Feb 28, 2011 at 11:15:39AM -0600, Stephen Montgomery-Smith wrote:
> I had a little script that would remove broken links. I used to do it
> like this:
> if ! stat -L $link > /dev/null; then rm $link; fi
> But recently (some time in February according to the CVS records) stat
> was chan
Jeremy Chadwick wrote:
Possibly you could use the example from the find(1) man page:
find -L /usr/ports/packages -type l -exec rm -- {} +
Delete all broken symbolic links in /usr/ports/packages.
(Note that the "+" on the end is not a typo, see the man page)
Brilliant!
Since
On Mon, Feb 28, 2011 at 11:15:39AM -0600, Stephen Montgomery-Smith wrote:
> I had a little script that would remove broken links. I used to do
> it like this:
>
> if ! stat -L $link > /dev/null; then rm $link; fi
>
> But recently (some time in February according to the CVS records)
> stat was ch
On Mon, 28 Feb 2011 23:39:10 +0100, jhell wrote:
On Mon, 28 Feb 2011 12:15, stephen@ wrote:
I had a little script that would remove broken links. I used to do it
like this:
if ! stat -L $link > /dev/null; then rm $link; fi
But recently (some time in February according to the CVS records)
On Mon, 28 Feb 2011 12:15, stephen@ wrote:
I had a little script that would remove broken links. I used to do it like
this:
if ! stat -L $link > /dev/null; then rm $link; fi
But recently (some time in February according to the CVS records) stat was
changed so that stat -L would use lstat(2)
I had a little script that would remove broken links. I used to do it
like this:
if ! stat -L $link > /dev/null; then rm $link; fi
But recently (some time in February according to the CVS records) stat
was changed so that stat -L would use lstat(2) if the link is broken.
So I had to change