#!/bin/bash cleanupDir=${1%/} # remove trailing / if necessary echo $cleanupDir if [ -d $cleanupDir ]; then # check if cleanupDir is a directory cd $cleanupDir; else echo "Couldn't find directory to clean up" fi for file in $cleanupDir/*.*; do if [ -f $file ]; then for ending in "log" "ilg" "out" "toc" "aux" "synctex.gz" "idx" "ind"; do if [[ $file == *.$ending ]]; then rm "$file" echo -e "\033[93m rm $file \033[0m" fi done fi done