Path: csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: Bruce Lilly Newsgroups: gnu.bash.bug Subject: Re: Bash parameter expansion (remove largest trailing match, remove largest leading match, pattern replacement) does not work Date: Sat, 29 Aug 2020 16:07:42 -0400 Lines: 30 Approved: bug-bash@gnu.org Message-ID: References: NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: usenet.stanford.edu 1598731677 2286 209.51.188.17 (29 Aug 2020 20:07:57 GMT) X-Complaints-To: action@cs.stanford.edu Cc: bug-bash@gnu.org To: Koichi Murase Envelope-to: bug-bash@gnu.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=mtxbmDuFkDHOIaLSz5nTp55DxvYEJ88n+tYfpiuHVcM=; b=S6n9kcE6zOeE48lKEbmBnUAamFqefEckgW+SNM6IhB9b4y2Thuhw+GorS8LrOv3NoD ZCDbv9Kc67HCszSSu6q+SWR68oIy3l1594jJokIzimem1DmEc9x2jFgK9xh1PdfuFJhE M+fdUXRiwyRpX2S29g+2rsfCtcJnhb51Qhl8LgEUQ+qMS3Bz8CRkxuI0LJAkhr9xtPl3 n2396/Bfk3roxGcdgXn8l3bulRnlke1ivfy1t3BqqgukOSaKtdkyaZAL2Qd1ySpmbGqQ 5i9GiDpm7CAeJyq9Q8Xzz8KaZK2LEPH4wKcDxplcj5e7O+9sTGjjtnP05t9gOzSpQtmj JRUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=mtxbmDuFkDHOIaLSz5nTp55DxvYEJ88n+tYfpiuHVcM=; b=jKvFFg5rr0SLVrMf8caRd4EwEughyVhsNnEoeu3dRzvonjQoWNBc0aGuAk4sgII41o A25jzFRvL8o36nDkAgLTqXiCNje4dQ5sAxdm3fVHpsORZgybcllT7ScKkY8pE8Mj/uir OWq9IThjr7BG4/8EIn1Z/rDniN6VuKc0ZCYx2y/MCRgVaEvLAJDSAMLcigoMBn25rlvG xZdVuTO+jQy6+oaSDmNNostThKMb/3PWPJgp42i8lZfExP8HWMwErqYXCbrewtRZCjoI SqJHWc5pS3AomtT4oui+17IHdjRKnuzRE7OICNDUch1E7A4UZCSxATm0NuQ064gcNroi nSug== X-Gm-Message-State: AOAM533fBnounIHhE6ZRzJLD9uszTmGlQxWQI1nPzXEMTJlrS9gTVJHN WQJtCzJUAKuXih85h4cxZoqmrwMdUQxHrZCq7S8= X-Google-Smtp-Source: ABdhPJyxKtYpJfpK5mQ7jC3S4/6J8z3u+obFv3z/8LuQi766FgI4682KMopVCae9hWL0u3Uz/+0OZY3+PLkKcB/1MK4= X-Received: by 2002:a05:6602:15c3:: with SMTP id f3mr3586860iow.25.1598731673257; Sat, 29 Aug 2020 13:07:53 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::d2c; envelope-from=bruce.lilly@gmail.com; helo=mail-io1-xd2c.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Content-Filtered-By: Mailman/MimeDel 2.1.23 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: X-Mailman-Original-References: Xref: csiph.com gnu.bash.bug:16856 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 work > for me with separator1='/'. The pattern that you constructed from > separator2='\057' is just not supported by Bash. That's surprising, as octal and hexadecimal escapes are fairly common. Next, you specify > exactly the same script `shellbug' to both Bash and ksh93, so I could > assume that you are missing the Bash-specific `shopt -s extglob' in > the script because otherwise, ksh93 would have complained it. That is > all what I can guess from your original post. > Yes, I'm still looking into that (along with updating a couple of FreeBSD machines, eating lunch, and monitoring a couple of downloads). I'll obviously have to wrap the "shopt" bit in a wrapper; is there some minimum bash version that supports it? > >