init.d/bootmisc: POSIX XSI shellism.

In a pathname expansion, specifically single-character match, the pure
POSIX specification uses '!' as the Negation character where a regular
expression would normally be '^'.

Regular expression: "a[^a]a"
Pathname expansion pattern: "a[!a]a"

Reference:
IEEE Std 1003.1, 2004 Edition
2. Shell Command Language
2.13 Pattern Matching Notation
2.13.1 Patterns Matching a Single Character

> The description of basic regular expression bracket expressions in the
> Base Definitions volume of IEEE Std 1003.1-2001, Section 9.3.5, RE
> Bracket Expression shall also apply to the pattern bracket expression,
> except that the exclamation mark character ( '!' ) shall replace the
> circumflex character ( '^' ) in its role in a "non-matching list" in
> the regular expression notation. A bracket expression starting with an
> unquoted circumflex character produces unspecified results.

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
This commit is contained in:
Robin H. Johnson 2012-11-06 22:49:49 +00:00
parent ec60e20331
commit f6c3896087

View File

@ -27,7 +27,7 @@ cleanup_tmp_dir()
ebegin "Wiping $dir directory"
# Faster than raw find
if ! rm -rf -- [^ajlq\.]* 2>/dev/null ; then
if ! rm -rf -- [!ajlq\.]* 2>/dev/null ; then
# Blah, too many files
find . -maxdepth 1 -name '[^ajlq\.]*' -exec rm -rf -- {} +
fi