[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: ["Davide G. M. Salvetti" <salve@debian.org>] emacsen: need plan to fix leftover cruft in share/emacs/XX.Y...



>>>>>  DGMS == Davide G M Salvetti [2001-2-3]

DGMS> What about this (bash) shell code?

Whew, I forgot «shopt -s nullglob», which is quite essential indeed, and
should probably be always on in your shell scripts:
>----------------------------------------------------------------------<
### Historic cleanup code
clean_old_cruft () {
    rm -f /usr/share/emacs/$1/site-lisp/mailcrypt/CompilationLog.gz
    rmdir --ignore-fail-on-non-empty --parents \
	/usr/share/emacs/$1/site-lisp/mailcrypt/
}
shopt -s nullglob
## Note that /usr/share/emacs/site-lisp/mailcrypt is _not_ enclosed in the
## following pattern, and it shouldn't be.
for i in /usr/share/emacs/*/site-lisp/mailcrypt/; do
    i=${i#/usr/share/emacs/}
    i=${i%/site-lisp/mailcrypt/}
    test -e /usr/bin/emacs-$i || clean_old_cruft $i
done
>----------------------------------------------------------------------<

Thanks,

-- 
Davide Giovanni Maria Salvetti
W: http://www.linux.it/~salve/
OpenPGP (GPG) Key ID: 939686D5



Reply to: