bashcore-file

Delete program core file in bash script


I'm trying to delete the core file generated from when my program suddenly crashes.

For that i use this piece of code:

find . -name 'core' -delete

My question is: Is this a correct way of doing it ? Is there a better and more efficient way?


Solution

  • If you indeed want to delete those core file, you can use:

    find . -name "core*" -exec rm -f {} \;
    

    Note: [including semicolon]