Path: csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: Koichi Murase 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 04:27:35 +0900 Lines: 35 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" Content-Transfer-Encoding: quoted-printable X-Trace: usenet.stanford.edu 1598729273 1303 209.51.188.17 (29 Aug 2020 19:27:53 GMT) X-Complaints-To: action@cs.stanford.edu Cc: bug-bash@gnu.org To: Bruce Lilly 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:content-transfer-encoding; bh=Ja2GmSClzV14vvfhZEwSlEORGLpjvE5ZGNUzfru0EWQ=; b=hKJUlRHe2O7VfOeVJGDJAGLtSliTvRJIs5dYmSZfIEjYioT7BBudJqIEkCLb/FeLZ+ eomp2LloRJ8ijqkpgiK9DBoyG3v+qzyr3bn58sbLIpq7TY47o55QYQbdXkbfpOEghWWw sIgwrKRSscGkwYYxztDrdwJAQ69y7kBY4rawzAiSWybsPRCnH2rqj5H6DViMAVjhJ2IL +CAzYvow/KF4rPwX8YdBe/TMv0Ci8qt1JVk6uANXH/j82sfZzLH/HZYNay9HkpC0qE79 E6v6XtzkHXltYy5hvPtt+PjK9EjGPvx9baeVrl0ucYFXhaLOc/C+uD/emdse8AshKt2A Zd2Q== 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:content-transfer-encoding; bh=Ja2GmSClzV14vvfhZEwSlEORGLpjvE5ZGNUzfru0EWQ=; b=aYS1yHfch1SqKGXRoKvHIye7C7B7Vi3jB02ngbTRKvVI6JzJBICexKh38LjtTjPeJ4 HVa/+Gdrx6EK1jLbvCx67PQpoQf7SYKBSCK9xmTHQ92qyx7toMoGK7e5AshIY9SDCEEH GJyCASXRa4q0i4yTnu3vYe1GX8osHp/2S6Udz0GBoHIi6ky/KSUMqXSgtB/dSlMd7RP6 rDjXVOOsbfkYra+LhnYdJhg5vSc/CyPbI25BzKptn9vJUC1OTGc7C4JVHWB3heBkWspi VSydG5qwP/VsNmwuTwL/b0aCCjF63ZnWajOnQUYwXLG3y5ADDJJjL5uOvzYq6Wl4ZdwP qOxA== X-Gm-Message-State: AOAM531c/9utYknokARC0fW+WdVRXcXOJL14XoBGFOkK+2KEtqMqTCQg lbPnPty0wCJ3z9qdQ3DPcwheCZk+2iv1zvRF1fk= X-Google-Smtp-Source: ABdhPJwrErpY4X63XLPbwRcpKbosN/ywjnZ21QrXIJTtPkAIFQ7nEuM6pLi4+1M5bok6Ofth63LiVzfyKYatj3qEzWU= X-Received: by 2002:a50:ba8c:: with SMTP id x12mr4720247ede.319.1598729266973; Sat, 29 Aug 2020 12:27:46 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::52c; envelope-from=myoga.murase@gmail.com; helo=mail-ed1-x52c.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, 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-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:16852 2020=E5=B9=B48=E6=9C=8830=E6=97=A5(=E6=97=A5) 3:55 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. Please don't assume that I have assumed something strange. To begin with, you didn't provide the script `shellbug', so something needs to be assumed anyway. Since it seems you are aware that your original post would be unclear and confuse others, you could have just included the contents of the file `shellbug'. Anyway, I did NOT assume that you have literally written broken quoting like separator2(octal escape)=3D\057 pattern1=3D${number1}(${separator1}) I assumed that you have written like separator2=3D'\057' pattern1=3D"${number1}(${separator1})" because otherwise, it doesn't work with ksh93 either. To explain it in more detail, first, these parameter expansions work for me with separator1=3D'/'. The pattern that you constructed from separator2=3D'\057' is just not supported by Bash. 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. -- Koichi