From 9dfd2534710381d6ad18aaf8843c52ba9b58c551 Mon Sep 17 00:00:00 2001 From: maxnikulin Date: Tue, 18 Apr 2023 18:16:04 +0700 Subject: [PATCH] Updated SC3026 (markdown): Historical links for ! vs ^ in globs --- SC3026.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SC3026.md b/SC3026.md index d634cb4..86ff8a2 100644 --- a/SC3026.md +++ b/SC3026.md @@ -18,6 +18,8 @@ echo foo-[!0]*.jpg However, strictly speaking, the only range complement syntax guaranteed to be supported across shells is `[!c]`. POSIX explicitly states that behavior of `[^c]` is unspecified. Dash used to support `[^c]` when compiled with `fnmatch` and `glob` from glibc, but it was considered as a [bug](https://lore.kernel.org/dash/09fd70edcf08c75b4f9f2e158e3e6c0832d35d90.camel@scientia.org/t/#u) and fixed in version 0.5.12. Busybox has a similar [bug 14516](https://bugs.busybox.net/show_bug.cgi?id=14516). +Discrepancy of negation syntax in regular expressions and shell pattern matching appeared in early UNIX versions. Pipeline syntax in shells had not settled yet, some terminals had no `|` key, so `^` was used there. That is why in some shells exclamation mark `!` was chosen instead of circumflex (caret) `^` symbol for negation in globs. For more details related to shell history see ["The `^` `=` `|` ?" thread](https://inbox.vuxu.org/tuhs/20030126014003.GA3818@sydney.worldwide.lemis.com/T/#u) in the Unix Heritage Society mailing list or [Sven Mascheck. The Traditional Bourne Shell Family. History and Development](https://www.in-ulm.de/~mascheck/bourne/) page. + ### Exceptions: If you only intend to target shells that supports this feature, you can change