scripts/texclean: Support files with spaces

master
Pierre Neidhardt 2015-12-02 12:23:44 +11:00
parent edad8e07c0
commit 33cefa0f11
1 changed files with 13 additions and 11 deletions

View File

@ -16,20 +16,22 @@ EOF
fi
for i ; do
while read -r FILE; do
case FILE in
while read -r file; do
case "$file" in
*/*) ;;
*)
FILE="./$FILE" ;;
file="./$file" ;;
esac
DIRNAME="${FILE%/*}"
BASENAME="${FILE##*/}"
BASENAME="${BASENAME%.*}"
rm -v $(
for j in aux bbl blg cp cps fn glg glo gls idx ilg ind ky lof log maf mt mtc nav out pg snm synctex.gz synctex tns toc tp vr vrs xdy
do
echo "$DIRNAME/$BASENAME.$j"
done) 2>/dev/null
dirname="${file%/*}"
basename="${file##*/}"
basename="${basename%.*}"
## Reset arg list (big performance boost).
set --
for j in aux bbl blg cp cps fn glg glo gls idx ilg ind ky lof log maf mt mtc nav out pg snm synctex.gz synctex tns toc tp vr vrs xdy
do
set -- "$@" "$dirname/$basename.$j"
done
rm -v "$@" 2>/dev/null
done <<EOF
$(find "$i" -type f \( -name "*.tex" -o -name "*.texi" \) )
EOF