[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Query on wc
From: |
Pádraig Brady |
Subject: |
Re: Query on wc |
Date: |
Wed, 09 Aug 2006 21:56:04 +0100 |
User-agent: |
Mozilla Thunderbird 1.0.8 (X11/20060502) |
Andreas Schwab wrote:
> Pádraig Brady <address@hidden> writes:
>
>
>>So you probably want to do:
>>
>>if ls /dir | grep -q '^core$'; then
>> echo "Core file found"
>>fi
>
>
> test -f /dir/core && echo "Core file found"
Yes I didn't want to mention that :)
Modern linux systems at least can
have multiple core files called
core.1234, core.4312, ... etc.
which the above solution doesn't handle easily.
Here is a more robust solution using the method from
the core file reporting mode of http://www.pixelbeat.org/fslint/
find /dir -type f -name "*core*" -printf "%p\n" |
grep -E "/core$|\.core$|/core\.[0-9]+$" |
xargs -r file |
grep -qF "core file " && echo "Core file found"
Pádraig.