Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #14198
| Path | csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail |
|---|---|
| From | Paul Förster <paul.foerster@gmail.com> |
| Newsgroups | gnu.bash.bug |
| Subject | case pattern checking with bash -n fails |
| Date | Fri, 1 Jun 2018 19:17:29 +0200 |
| Lines | 82 |
| Approved | bug-bash@gnu.org |
| Message-ID | <mailman.951.1527874256.1292.bug-bash@gnu.org> (permalink) |
| NNTP-Posting-Host | lists.gnu.org |
| Mime-Version | 1.0 (Mac OS X Mail 11.3 \(3445.6.18\)) |
| Content-Type | text/plain; charset=us-ascii |
| Content-Transfer-Encoding | quoted-printable |
| X-Trace | usenet.stanford.edu 1527874256 20747 208.118.235.17 (1 Jun 2018 17:30:56 GMT) |
| X-Complaints-To | action@cs.stanford.edu |
| To | bug-bash@gnu.org |
| Envelope-to | bug-bash@gnu.org |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:content-transfer-encoding:mime-version:subject:message-id:date :to; bh=pOdHDYHzI+cjTbnpBTEXbQxDaZNg3R3LmIMDOZKKuoA=; b=gMiAo5dqPO9WxX6+HMSVO4geOSSZq8C9A6l76L/ttoVMYOTInLLC4Wg0enwzS3A2CE kLcPoMd567xNqNthwwCNguO07r614Wr/ukDhdr0GShbSPQCZahMt1HX/c0ENzsuhNQSR jR7Y1bfAeETIkB2P06P55LBMvBiBw0rHroM7IbwKCSd4F0WkLjafABt12tBVSQPafzsD Sq4rWi4ArJqtN1OduO6eI81osgAHeS2JuRXK/GIC4ITg94MYA2LOiJm9YopMKAFliWIw qoC2ZTAc4uaXJWPMcmi+6lt3jRgQra2JSeVtXNaW6Xt0r0gEPsAk0Yvzpvr8OHUw0b4t /FiA== |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:content-transfer-encoding:mime-version :subject:message-id:date:to; bh=pOdHDYHzI+cjTbnpBTEXbQxDaZNg3R3LmIMDOZKKuoA=; b=UX7sudDPeSLCJP+LkzT87sE5ZXawFIuSRvZqkw4RT0gT/oMWm6nSqyvRPq1AxCT5ja at9j33s9Soa/HEWmKUXfBMdqx9nyFl0PwmHz/lyBRAR+acaQANDIcAqxo/aRxicNjDRG +UTknyWp83p/v0gSKjHAoBj8vlN2sx36/cmIBEZDuDQaJIOAQ/ezhjpjhYzTUgvrmr7I qM7103WI5cli73IZWofg6G72SO4zdFs40RtweHXePe1cniSKUfirylbfbggikTZSx/1G 2GYa/WV3WwU5uZSij0g8K2WGThyaAEvAY3yCSvrSOJiRRteMfDZVXGUcgZnErpKdKVef 2PLQ== |
| X-Gm-Message-State | ALKqPwf/xb+sk1hxcnERwY+aE8kmEVhuHIzA8oyGchsA0wUpbJWmhQNR w0Im9P97qf7eI3lGbPYNWA34F4iV |
| X-Google-Smtp-Source | ADUXVKKg8VWBGBXH7hFvxNY6s+2LWNA1C3ZIA8+RJhWI46XQ9XVxhHlPZJP9OgX+SmfGNcppT+eQ5Q== |
| X-Received | by 2002:aa7:c250:: with SMTP id y16-v6mr7517099edo.87.1527873450887; Fri, 01 Jun 2018 10:17:30 -0700 (PDT) |
| X-Mailer | Apple Mail (2.3445.6.18) |
| X-detected-operating-system | by eggs.gnu.org: Genre and OS details not recognized. |
| X-Received-From | 2a00:1450:400c:c09::22f |
| X-Mailman-Approved-At | Fri, 01 Jun 2018 13:30:55 -0400 |
| 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:14198 |
Show key headers only | View raw
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc -I/home/abuild/rpmbuild/BUILD/bash-4.3 -L/home/abuild/rpmbuild/BUILD/bash-4.3/../readline-6.3
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-suse-linux-gnu' -DCONF_VENDOR='suse' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g -D_GNU_SOURCE -DRECYCLES_PIDS -Wall -g -Wuninitialized -Wextra -Wno-unprototyped-calls -Wno-switch-enum -Wno-unused-variable -Wno-unused-parameter -Wno-parentheses -ftree-loop-linear -pipe -DBNC382214=0 -DIMPORT_FUNCTIONS_DEF=0 -fprofile-use
uname output: Linux weasel 4.4.132-53-default #1 SMP Wed May 23 06:57:07 UTC 2018 (036cd2f) x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-suse-linux-gnu
Bash Version: 4.3
Patch Level: 42
Release Status: release
Description:
Bash seems to have a parens checking problem with patterns in a case statement using the -n option. I need a "case" where I can identify a word where a word starts with a letter and may be followed by zero or more letters, digits, dashes or underscores. It works fine when running, but miserably fails the bash -n test, which I also *need* it to pass. Or am I doing something wrong here?
System is openSUSE 42.3, all current patches applied. I can't change that.
Repeat-By:
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<------------------
Runs fine:
$ ./case-test "y"
y matches
$ ./case-test "1"
no match.
$ ./case-test "yes17match"
yes17match matches
$ ./case-test "17nomatch"
no match.
But fails -n check:
$ bash -n case-test
case-test: line 5: syntax error near unexpected token `('
case-test: line 5: ` +([[:alpha:]])*([[:alnum:]-_]))'
Also tried with leading open parens and other variations:
(+([[:alpha:]])*([[:alnum:]-_]))
(@([[:alpha:]])*([[:alnum:]-_]))
[[:alpha:]]*([[:alnum:]-_]))
...
Didn't work. All fail bash -n. Please advise.
--
cul8er
Paul
paul.foerster@gmail.com
Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread
case pattern checking with bash -n fails Paul Förster <paul.foerster@gmail.com> - 2018-06-01 19:17 +0200
csiph-web