Bash parameter expansion (remove largest trailing match, remove largest leading match, pattern replacement) does not work

2020-08-29 Thread Bruce Lilly
Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: netbsd Compiler: gcc Compilation CFLAGS: -O2 -D_FORTIFY_SOURCE=2 -I/usr/include -Wno-parentheses -Wno-format-security uname output: NetBSD cq60-615dx.blilly.net 9.0 NetBSD 9.0 (GENERIC) #0: Fri Feb 14 00:06:28 U

Re: Bash parameter expansion (remove largest trailing match, remove largest leading match, pattern replacement) does not work

2020-08-29 Thread Bruce Lilly
Robert, Did you look at the relevant bash manual pages linked in the bug report? > >

Re: Bash parameter expansion (remove largest trailing match, remove largest leading match, pattern replacement) does not work

2020-08-29 Thread Bruce Lilly
On Sat, Aug 29, 2020, 13:48 Robert Elz wrote: > Date:Sat, 29 Aug 2020 13:33:37 -0400 > From: Bruce Lilly > Message-ID: n...@mail.gmail.com> > > | Did you look at the relevant bash manual pages linked in the bug > report? > > Enough to kn

Re: Bash parameter expansion (remove largest trailing match, remove largest leading match, pattern replacement) does not work

2020-08-29 Thread Bruce Lilly
Please don't assume that something output by printf (without quoting) for clarity is representative of actual expansion by the shell when properly quoted. On Sat, Aug 29, 2020, 14:52 Koichi Murase wrote: > 2020-08-29 23:47 Bruce Lilly : > > Description: > > Bash

Re: Bash parameter expansion (remove largest trailing match, remove largest leading match, pattern replacement) does not work

2020-08-29 Thread Bruce Lilly
Thanks for the pointer to "shopt"; I'll check when I get a chance. On Sat, Aug 29, 2020, 14:52 Koichi Murase wrote: > 2020-08-29 23:47 Bruce Lilly : > > Description: > > Bash parameter expansion (remove largest trailing match, > > remove largest lead

Re: Bash parameter expansion (remove largest trailing match, remove largest leading match, pattern replacement) does not work

2020-08-29 Thread Bruce Lilly
Unfortunately, because bash is GPL, I can't post the copyrighted script which is covered by a non-GPL license. On Sat, Aug 29, 2020, 15:22 Ilkka Virta wrote: > On Sat, Aug 29, 2020 at 9:56 PM Bruce Lilly wrote: > >> Please don't assume that something output by printf

Re: Bash parameter expansion (remove largest trailing match, remove largest leading match, pattern replacement) does not work

2020-08-29 Thread Bruce Lilly
On Sat, Aug 29, 2020, 15:40 Koichi Murase wrote: > Don't worry. In this case, the GPL doesn't apply. Please read the > following Q&A. > > https://www.gnu.org/licenses/gpl-faq.en.html#IfInterpreterIsGPL > > Even if your original `shellbug' is licensed under something other, > and it prohibits to

Re: Bash parameter expansion (remove largest trailing match, remove largest leading match, pattern replacement) does not work

2020-08-29 Thread Bruce Lilly
On Sat, Aug 29, 2020, 15:27 Koichi Murase wrote: > I assumed that you have written like > > separator2='\057' > pattern1="${number1}(${separator1})" > > because otherwise, it doesn't work with ksh93 either. > You are correct. To explain it in more detail, first, these parameter expansions w

Re: Bash parameter expansion (remove largest trailing match, remove largest leading match, pattern replacement) does not work

2020-08-29 Thread Bruce Lilly
cally the issue, and it goes both ways (i.e. also people writing GPL'ed code based on non-GPL source (or slapping a GPL license on non-GPL code); there's a rather famous case http://undeadly.org/cgi?action=article&sid=20070913014315 ). > 2020-08-30 5:07 Bruce Lilly : > > That

Re: Bash parameter expansion (remove largest trailing match, remove largest leading match, pattern replacement) does not work

2020-08-29 Thread Bruce Lilly
On Sat, Aug 29, 2020 at 9:12 PM Lawrence Velázquez wrote: > (a) $'...' is not POSIX. For instance, dash does not recognize it. dash also doesn't have adequate pattern matching for the example task (building a path while ensuring no empty components); it has no way to specify one-or-more (or zero