mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
usage and argument handling for bin/rm* and bin/touch* utilities
This commit is contained in:
@ -1,2 +1,24 @@
|
||||
#!/bin/sh
|
||||
find . \( -name '*.class' \) -print | xargs -t rm
|
||||
|
||||
# default is pwd
|
||||
if [ "$#" -eq 0 ]
|
||||
then
|
||||
set -- .
|
||||
elif [ "$1" = "-h" -o "$1" = "-help" ]
|
||||
then
|
||||
echo "Usage: ${0##*/} [dir1] .. [dirN]"
|
||||
echo " remove all .class files"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for i
|
||||
do
|
||||
if [ -d "$i" ]
|
||||
then
|
||||
echo "removing all .class files"
|
||||
find $i -name '*.class' -print | xargs -t rm
|
||||
else
|
||||
echo "no directory: $i"
|
||||
fi
|
||||
done
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
26
bin/rmcore
26
bin/rmcore
@ -1,3 +1,25 @@
|
||||
#!/bin/sh
|
||||
# find . \( -name 'core' \) -exec ls -l {} \; -exec rm {} \;
|
||||
find . \( -type f -name 'core' -o -name 'core.[1-9]*' -o -name 'vgcore.*' \) -print | xargs -t rm
|
||||
|
||||
# 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
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
|
||||
22
bin/rmdepall
22
bin/rmdepall
@ -1,15 +1,19 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ $# -eq 0 ]
|
||||
if [ "$1" = "-h" -o "$1" = "-help" -o "$#" -gt 1 ]
|
||||
then
|
||||
find . \( -name '*.dep' \) -print | xargs -t rm
|
||||
elif [ $# -eq 1 ]
|
||||
then
|
||||
echo "Removing all dep files containing $1..."
|
||||
find . -name '*.dep' -exec grep "$1" '{}' \; -exec rm '{}' \;
|
||||
else
|
||||
echo "Usage: ${0##/} to remove all .dep files"
|
||||
echo " ${0##/} <file> to remove all .dep files referring to <file>"
|
||||
echo "Usage: ${0##*/} : remove all .dep files"
|
||||
echo " ${0##*/} <file> : remove all .dep files referring to <file>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$#" -eq 0 ]
|
||||
then
|
||||
echo "removing all .dep files"
|
||||
find . -name '*.dep' -print | xargs -t rm
|
||||
else
|
||||
echo "removing all .dep files containing $1..."
|
||||
find . -name '*.dep' -exec grep "$1" '{}' \; -exec rm '{}' \;
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
24
bin/rmoall
24
bin/rmoall
@ -1,2 +1,24 @@
|
||||
#!/bin/sh
|
||||
find . \( -name '*.o' \) -print | xargs -t rm
|
||||
|
||||
# default is pwd
|
||||
if [ "$#" -eq 0 ]
|
||||
then
|
||||
set -- .
|
||||
elif [ "$1" = "-h" -o "$1" = "-help" ]
|
||||
then
|
||||
echo "Usage: ${0##*/} [dir1] .. [dirN]"
|
||||
echo " remove all .o files"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for i
|
||||
do
|
||||
if [ -d "$i" ]
|
||||
then
|
||||
echo "removing all .o files: $i"
|
||||
find $i -name '*.o' -print | xargs -t rm
|
||||
else
|
||||
echo "no directory: $i"
|
||||
fi
|
||||
done
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
25
bin/rm~all
25
bin/rm~all
@ -1,3 +1,24 @@
|
||||
#!/bin/sh
|
||||
# find . \( -name '*~' -o -name '.*~' \) -exec ls -l {} \; -exec rm {} \;
|
||||
find . \( -name '*~' -o -name '.*~' \) -print | xargs -t rm
|
||||
|
||||
# default is pwd
|
||||
if [ "$#" -eq 0 ]
|
||||
then
|
||||
set -- .
|
||||
elif [ "$1" = "-h" -o "$1" = "-help" ]
|
||||
then
|
||||
echo "Usage: ${0##*/} [dir1] .. [dirN]"
|
||||
echo " remove all *~ files"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for i
|
||||
do
|
||||
if [ -d "$i" ]
|
||||
then
|
||||
echo "removing all *~ files"
|
||||
find $i \( -name '*~' -o -name '.*~' \) -print | xargs -t rm
|
||||
else
|
||||
echo "no directory: $i"
|
||||
fi
|
||||
done
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
14
bin/touchapp
14
bin/touchapp
@ -1,3 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "$#" -ne 0 ]
|
||||
then
|
||||
echo "Usage: ${0##*/}"
|
||||
echo " touch FOAM_APPBIN"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -d "$FOAM_APPBIN" ]
|
||||
then
|
||||
echo "touching FOAM_APPBIN: $FOAM_APPBIN"
|
||||
touch $FOAM_APPBIN/*
|
||||
else
|
||||
echo "no FOAM_APPBIN: $FOAM_APPBIN"
|
||||
fi
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
23
bin/touchdep
23
bin/touchdep
@ -1,3 +1,24 @@
|
||||
#!/bin/sh
|
||||
|
||||
find . \( -name '*.dep' \) -print | xargs -t touch
|
||||
# default is pwd
|
||||
if [ "$#" -eq 0 ]
|
||||
then
|
||||
set -- .
|
||||
elif [ "$1" = "-h" -o "$1" = "-help" ]
|
||||
then
|
||||
echo "Usage: ${0##*/} [dir1] .. [dirN]"
|
||||
echo " touch all .dep files"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for i
|
||||
do
|
||||
if [ -d "$i" ]
|
||||
then
|
||||
echo "touching all .dep files: $i"
|
||||
find $i -name '*.dep' -print | xargs -t touch
|
||||
else
|
||||
echo "no directory: $i"
|
||||
fi
|
||||
done
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
16
bin/touchlib
16
bin/touchlib
@ -1,3 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
touch $FOAM_LIBBIN/*
|
||||
if [ "$#" -ne 0 ]
|
||||
then
|
||||
echo "Usage: ${0##*/}"
|
||||
echo " touch FOAM_LIBBIN"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -d "$FOAM_LIBBIN" ]
|
||||
then
|
||||
echo "touching FOAM_LIBBIN: $FOAM_LIBBIN"
|
||||
touch $FOAM_LIBBIN/* $FOAM_LIBBIN/*/*
|
||||
else
|
||||
echo "no FOAM_LIBBIN: $FOAM_LIBBIN"
|
||||
fi
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
23
bin/toucho
23
bin/toucho
@ -1,3 +1,24 @@
|
||||
#!/bin/sh
|
||||
|
||||
find . \( -name '*.o' \) -print | xargs -t touch
|
||||
# default is pwd
|
||||
if [ "$#" -eq 0 ]
|
||||
then
|
||||
set -- .
|
||||
elif [ "$1" = "-h" -o "$1" = "-help" ]
|
||||
then
|
||||
echo "Usage: ${0##*/} [dir1] .. [dirN]"
|
||||
echo " touch all .o files"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for i
|
||||
do
|
||||
if [ -d "$i" ]
|
||||
then
|
||||
echo "touching all .o files: $i"
|
||||
find $i -name '*.o' -print | xargs -t touch
|
||||
else
|
||||
echo "no directory: $i"
|
||||
fi
|
||||
done
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user