Findutils added in release 4.2.3 a new --delete action for deleting
matching files. This action performs better than -exec rm {} \;
because it doesn't have to spawn an external process. This change
uses a new action whenever is possible.
Change-Id: Iff16a86b18e924cfe78ac7c6107910940ce51e03
| ... | ... |
@@ -149,5 +149,10 @@ rm -rf ~/.config/openstack |
| 149 | 149 |
|
| 150 | 150 |
# Clean up all *.pyc files |
| 151 | 151 |
if [[ -n "$DEST" ]] && [[ -d "$DEST" ]]; then |
| 152 |
- sudo find $DEST -name "*.pyc" -print0 | xargs -0 rm |
|
| 152 |
+ find_version=`find --version | awk '{ print $NF; exit}'`
|
|
| 153 |
+ if vercmp "$find_version" "<" "4.2.3" ; then |
|
| 154 |
+ sudo find $DEST -name "*.pyc" -print0 | xargs -0 rm |
|
| 155 |
+ else |
|
| 156 |
+ sudo find $DEST -name "*.pyc" -delete |
|
| 157 |
+ fi |
|
| 153 | 158 |
fi |