Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #14199
| From | Greg Wooledge <wooledg@eeg.ccf.org> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | Re: case pattern checking with bash -n fails |
| Date | 2018-06-01 13:35 -0400 |
| Message-ID | <mailman.952.1527874569.1292.bug-bash@gnu.org> (permalink) |
| References | <6551C8F0-FC3B-4C44-98CB-2C992DE95781@gmail.com> |
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