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 14:55:28 -0400 Lines: 20 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 1598727343 32610 209.51.188.17 (29 Aug 2020 18:55:43 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=cVSmTc6bQVTEFwVMS8+Glrm+vzpap2ZZPGvdJKb1t9Q=; b=J6LUdB/s9mjvYT/mZFwOWxTby5pbFRFFdrlkL9Oo1NnMs35PhNlRhzZqOrqoXEljPz Ji97VhjdOR+YUiO4bbPuxW/u1hWYPe6FBVKuPmd674dD4FnNvLdU0Ohx+PnQ85j4J92T ahuw0W5Z42GXUP0pw4itTuMvT+puGXGk0gjibB5V5LOv5zqdk/iCxLPDvoLwXv269Ct+ 8L63PEK73C6osZjbXHEzdbBzAvr0ZIdSNFBKUqqtZD1r+nwNFukzjt6dQchMzTwOqkbC nPsyBVexSE+Hu0I5fLzpKiQD7l5xHiGWMq+EF7CiT5FzY9zE/677FPE5btmGGG6c2Bgl 0wcw== 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=cVSmTc6bQVTEFwVMS8+Glrm+vzpap2ZZPGvdJKb1t9Q=; b=Tei1VrUcvlpRuNzISQY5HBQuGPDdUAfH0s+FPgYxulDGh5XvzhkBubzy2zTAoiIQD+ LXaP5GSoXfyraLfNvGw3FKQp5qkfywJvWWvBZP4Pm5YBgDNlYXpt2GrRMQQiU2Jt7hGF 3uABocKZKlHiVXJc/Mw2vbNRuvlcBCJAmEqMFegUNbSJfSd+kXLK9+CsGxeOwnwdWZho +9R892kZJj/6UMey4D2ry7+ZIQClmmhM0uIBSBjWzCxgiuaAmcbOv6rPgxTu1TYgLVjK 4gi6xL6sWYOK8P03TxtYC1O+TRdj9qtc4vxUCYdH/FlIwWkxUhb21kNr2juasRJbe7Co 3HRw== X-Gm-Message-State: AOAM533BEqHm++qRH36JZFCJ/djPQZKrCtK799GgVjDjg/+wcWQYpmiX TaOzaIMqYe9b2LcSuEaDp5MzvnL2vZ+74VA3W0s= X-Google-Smtp-Source: ABdhPJzl15MHksAxv2zfEx/nCUTVnD41k+3nhhDYGvtrtIkGVtSgiG8NLOg6XCV8StXiBqakcer2/xMm/h5WzFMcHeo= X-Received: by 2002:a05:6602:15c3:: with SMTP id f3mr3435681iow.25.1598727338571; Sat, 29 Aug 2020 11:55:38 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::d32; envelope-from=bruce.lilly@gmail.com; helo=mail-io1-xd32.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:16848 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 parameter expansion (remove largest trailing match, > > remove largest leading match, pattern replacement) does not work > > In short, (1) ``octal escape \057'' doesn't have special meaning in > Bash glob patterns. `[\057]' means just one of a literal backslash or > digits 0, 5, or 7. (2) You need to set `shopt -s extglob` to use > extended glob patterns like `+(...)' and `*(...)'. Please look at the > paragraph above the list of extended patterns in the manual. > > -- > Koichi >