projects
/
grml-etc-core.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
zshrc: support systems without capacity file in batterylinux() [Closes: issue1333]
[grml-etc-core.git]
/
usr_share_grml
/
zsh
/
functions
/
purge
diff --git
a/usr_share_grml/zsh/functions/purge
b/usr_share_grml/zsh/functions/purge
index
aa5066a
..
fab7fcd
100644
(file)
--- a/
usr_share_grml/zsh/functions/purge
+++ b/
usr_share_grml/zsh/functions/purge
@@
-2,15
+2,18
@@
emulate -L zsh
setopt HIST_SUBST_PATTERN
emulate -L zsh
setopt HIST_SUBST_PATTERN
-local -a TEXTEMPFILES GHCTEMPFILES PYTEMPFILES FILES
+local -a TEXTEMPFILES GHCTEMPFILES PYTEMPFILES
+local -a -U FILES
-TEXTEMPFILES=(*.tex(N:s/%tex/'(log|toc|aux|nav|snm|out|tex.backup|bbl|blg|bib.backup|vrb|lof|lot|hd|idx)(N)'/))
+[[ -d "$1" ]] && { TRAPEXIT() { popd -q } && pushd -q "$1" }
-
GHCTEMPFILES=(*.(hs|lhs)(N:r:s/%/'.(hi|hc|(p|u|s)_(o|hi))(
N)'/))
+
TEXTEMPFILES=(*.tex(N-.:s/%tex/'(log|toc|aux|nav|snm|out|tex.backup|bbl|blg|bib.backup|vrb|lof|lot|hd|idx|fdb_latexmk|fls|glo|ilg|ind|synctex.gz)(.
N)'/))
-
PYTEMPFILES=(*.py(N:s/%py/'(pyc|pyo)(
N)'/))
+
GHCTEMPFILES=(*.(hs|lhs)(N-.:r:s/%/'.(hi|hc|(p|u|s)_(o|hi))(.
N)'/))
-LONELY_MOOD_FILES=((*.mood)(.NDe:'local -a AF;AF=( ${${REPLY#.}%mood}(mp3|flac|ogg|asf|wmv|aac)(N) ); [[ -z "$AF" ]]':))
+PYTEMPFILES=(*.py(N-.:s/%py/'(pyc|pyo)(.N)'/))
+
+LONELY_MOOD_FILES=((*.mood)(.NDe:'local -a AF;AF=( ${${REPLY#.}%mood}(mp3|flac|ogg|asf|wmv|aac)(N-.) ); [[ -z "$AF" ]]':))
ZSH_COMPILED=(*.zwc(.NDe:'[[ -f ${REPLY%.zwc} && ${REPLY%.zwc} -nt ${REPLY} ]]':))
ZSH_COMPILED=(*.zwc(.NDe:'[[ -f ${REPLY%.zwc} && ${REPLY%.zwc} -nt ${REPLY} ]]':))
@@
-18,8
+21,10
@@
FILES=(
*~(.N)
\#*\#(.N)
*.o(.N)
*~(.N)
\#*\#(.N)
*.o(.N)
+ *.d(.N)
+ *.d.<->(.N)
a.out(.N)
a.out(.N)
- (*.|)core(.N)
+ (*.|)core(
|.<->)(
.N)
*.cmo(.N)
*.cmi(.N)
.*.swp(.N)
*.cmo(.N)
*.cmi(.N)
.*.swp(.N)
@@
-39,11
+44,12
@@
local CURDIRSUDO=""
[[ ! -w ./ ]] && CURDIRSUDO=$SUDO
if [[ $NBFILES > 0 ]] ; then
[[ ! -w ./ ]] && CURDIRSUDO=$SUDO
if [[ $NBFILES > 0 ]] ; then
- print -l $FILES
+ print "in $PWD:"
+ print -f " %s\n" $FILES
local ans
local ans
- echo -n "Remove these files? [y/
n
] "
+ echo -n "Remove these files? [y/
N
] "
read -q ans; echo
read -q ans; echo
- if [[ $ans ==
"y"
]] ; then
+ if [[ $ans ==
[yY]
]] ; then
$CURDIRSUDO rm ${FILES}
echo ">> $PWD purged, $NBFILES files removed"
else
$CURDIRSUDO rm ${FILES}
echo ">> $PWD purged, $NBFILES files removed"
else