Andreas Schwab wrote:
> Pádraig Brady <[EMAIL PROTECTED]> 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.


_______________________________________________
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to