I want to delete some files from the working directory, but first list the files to be deleted:
#!/usr/bin/env zsh
tput bold;
tput setaf 1;
echo "You are about to DELETE ALL auxillary files and Tmp files"
echo "These are the files to be deleted:"
tput sgr0;
for ext in log out aux dvi lof lot bit idx glo bbl bcf ilg toc ind out blg fdb_latexmk fls run.xml pyg pyg.out
do
find . -type f -name "*.$ext" -not -path "./.git/*" -print
done
find Tmp/ -type f
tput setaf 3;
read -s -k "?Press any key to purge!"$'\n'
tput sgr0;
for ext in log out aux dvi lof lot bit idx glo bbl bcf ilg toc ind out blg fdb_latexmk fls run.xml pyg pyg.out
do
find . -type f -name "*.$ext" -not -path "./.git/*" -delete
done
find Tmp/ -type f -delete
tput bold;
tput setaf 1;
echo "DONE"
I was wondering if it is possible to avoid repeating a large chunk of code twice.