Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #14199
| Path | csiph.com!fu-berlin.de!usenet.stanford.edu!not-for-mail |
|---|---|
| From | Greg Wooledge <wooledg@eeg.ccf.org> |
| Newsgroups | gnu.bash.bug |
| Subject | Re: case pattern checking with bash -n fails |
| Date | Fri, 1 Jun 2018 13:35:34 -0400 |
| Lines | 26 |
| Approved | bug-bash@gnu.org |
| Message-ID | <mailman.952.1527874569.1292.bug-bash@gnu.org> (permalink) |
| References | <6551C8F0-FC3B-4C44-98CB-2C992DE95781@gmail.com> |
| NNTP-Posting-Host | lists.gnu.org |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=iso-8859-1 |
| Content-Transfer-Encoding | 8bit |
| X-Trace | usenet.stanford.edu 1527874570 20898 208.118.235.17 (1 Jun 2018 17:36:10 GMT) |
| X-Complaints-To | action@cs.stanford.edu |
| To | bug-bash@gnu.org |
| Envelope-to | bug-bash@gnu.org |
| Mail-Followup-To | bug-bash@gnu.org |
| Content-Disposition | inline |
| In-Reply-To | <6551C8F0-FC3B-4C44-98CB-2C992DE95781@gmail.com> |
| User-Agent | NeoMutt/20170113 (1.7.2) |
| X-detected-operating-system | by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] |
| X-Received-From | 139.137.100.1 |
| X-BeenThere | bug-bash@gnu.org |
| X-Mailman-Version | 2.1.21 |
| Precedence | list |
| List-Id | Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org> |
| List-Unsubscribe | <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe> |
| List-Archive | <http://lists.gnu.org/archive/html/bug-bash/> |
| List-Post | <mailto:bug-bash@gnu.org> |
| List-Help | <mailto:bug-bash-request@gnu.org?subject=help> |
| List-Subscribe | <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe> |
| Xref | csiph.com gnu.bash.bug:14199 |
Show key headers only | View raw
On Fri, Jun 01, 2018 at 07:17:29PM +0200, Paul Förster wrote:
> file: case-test (700)
> ==================8<------------------
> #!/bin/bash
>
> shopt -s extglob
> case "${1}" in
> +([[:alpha:]])*([[:alnum:]-_]))
> echo "${1} matches" ;;
> # ... some more cases here...
> *) echo "no match." ;;
> esac
> ==================8<------------------
> $ bash -n case-test
> case-test: line 5: syntax error near unexpected token `('
> case-test: line 5: ` +([[:alpha:]])*([[:alnum:]-_]))'
With -n in effect, bash will never execute the shopt -s extglob command,
so it never puts the parser into extglob mode, so it fails with a syntax
error on the extended glob.
You'll need to put the parser into extglob mode manually:
bash -n -O extglob case-text
Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread
Re: case pattern checking with bash -n fails Greg Wooledge <wooledg@eeg.ccf.org> - 2018-06-01 13:35 -0400
csiph-web