Path: csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: Robert Elz Newsgroups: gnu.bash.bug Subject: Re: Bash parameter expansion (remove largest trailing match, remove largest leading match, pattern replacement) does not work Date: Sun, 30 Aug 2020 16:00:46 +0700 Lines: 21 Approved: bug-bash@gnu.org Message-ID: References: <26506.1598778046@jinx.noi.kre.to> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: usenet.stanford.edu 1598778080 30178 209.51.188.17 (30 Aug 2020 09:01:20 GMT) X-Complaints-To: action@cs.stanford.edu Cc: =?UTF-8?Q?Lawrence_Vel=C3=A1zquez?= , Koichi Murase , bug-bash@gnu.org To: Bruce Lilly Envelope-to: bug-bash@gnu.org In-Reply-To: X-Host-Lookup-Failed: Reverse DNS lookup failed for 2001:3c8:9009:181::2 (deferred) Received-SPF: permerror client-ip=2001:3c8:9009:181::2; envelope-from=kre@munnari.OZ.AU; helo=munnari.OZ.AU X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, RDNS_NONE=0.793, T_SPF_HELO_PERMERROR=0.01, T_SPF_PERMERROR=0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <26506.1598778046@jinx.noi.kre.to> X-Mailman-Original-References: Xref: csiph.com gnu.bash.bug:16864 Date: Sat, 29 Aug 2020 22:08:14 -0400 From: Bruce Lilly Message-ID: =7C dash also doesn't have adequate pattern matching for the example =7C task (building a path while ensuring no empty components); it =7C has no way to specify one-or-more (or zero-or-more) occurrences =7C of a pattern such as a slash. It does, you just don't get to do it in one absurdly complex variable expansion. There is very little that can't be done in sh that is reasonable to attempt in sh code (floating point matrix inversions are probably not a candidate for example) - including even the original 7th edition Bourne sh (with no functions, nothing builtin, bugs all over the place, ...) Sometimes it takes a bunch of code, and sometimes it might not be extremely fast, but it is possible. kre