mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-12-28 03:37:59 +00:00
STYLE: adjust ordering of 'find' command arguments
- use -name test before -type test to avoid calling stat(2) on every file. - use -delete instead of -exec rm to avoid forking
This commit is contained in:
@ -35,6 +35,7 @@ then
|
||||
set -- .
|
||||
elif [ "$1" = "-h" -o "$1" = "-help" ]
|
||||
then
|
||||
exec 1>&2
|
||||
echo "Usage: ${0##*/} [dir1] .. [dirN]"
|
||||
echo " remove all *~ files"
|
||||
exit 1
|
||||
@ -45,8 +46,8 @@ for i
|
||||
do
|
||||
if [ -d "$i" ]
|
||||
then
|
||||
echo "removing all *~ files: $i"
|
||||
find $i \( -name '*~' -o -name '.*~' \) -print | xargs -t rm 2>/dev/null
|
||||
echo "removing all *~ files: $i" 1>&2
|
||||
find $i \( -name '*~' -o -name '.*~' \) -type f -delete -print
|
||||
else
|
||||
echo "no directory: $i" 1>&2
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user