X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=usr_share_grml%2Fzsh%2Ffunctions%2Fpurge;h=3acf28d3974cbcfc430d37cb6b5d21e9f7cf73dd;hb=33098236a1e383685f45ead5ed1af047ee96a036;hp=aa5066a6279e9a2880da615b4ad67777a3e7e5f5;hpb=dffa45464d731201c72023092498d532d1799920;p=grml-etc-core.git diff --git a/usr_share_grml/zsh/functions/purge b/usr_share_grml/zsh/functions/purge index aa5066a..3acf28d 100644 --- a/usr_share_grml/zsh/functions/purge +++ b/usr_share_grml/zsh/functions/purge @@ -4,6 +4,8 @@ emulate -L zsh setopt HIST_SUBST_PATTERN local -a TEXTEMPFILES GHCTEMPFILES PYTEMPFILES FILES +[[ -d "$1" ]] && { TRAPEXIT() { popd -q } && pushd -q "$1" } + TEXTEMPFILES=(*.tex(N:s/%tex/'(log|toc|aux|nav|snm|out|tex.backup|bbl|blg|bib.backup|vrb|lof|lot|hd|idx)(N)'/)) GHCTEMPFILES=(*.(hs|lhs)(N:r:s/%/'.(hi|hc|(p|u|s)_(o|hi))(N)'/)) @@ -39,11 +41,12 @@ local CURDIRSUDO="" [[ ! -w ./ ]] && CURDIRSUDO=$SUDO if [[ $NBFILES > 0 ]] ; then - print -l $FILES + print "in $PWD:" + print -f " %s\n" $FILES local ans - echo -n "Remove these files? [y/n] " + echo -n "Remove these files? [y/N] " read -q ans; echo - if [[ $ans == "y" ]] ; then + if [[ $ans == [yY] ]] ; then $CURDIRSUDO rm ${FILES} echo ">> $PWD purged, $NBFILES files removed" else