#!/bin/sh # default is pwd if [ "$#" -eq 0 ] then set -- . elif [ "$1" = "-h" -o "$1" = "-help" ] then echo "Usage: ${0##*/} [dir1] .. [dirN]" echo " remove all core files" exit 1 fi for i do if [ -d "$i" ] then echo "removing all core files" find $i \( -type f -name 'core' -o -name 'core.[1-9]*' -o -name 'vgcore.*' \) -print | xargs -t rm else echo "no directory: $i" fi done #------------------------------------------------------------------------------