Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #14358
| Path | csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail |
|---|---|
| From | Denys Vlasenko <dvlasenk@redhat.com> |
| Newsgroups | gnu.bash.bug |
| Subject | Single quotes in ARG in "${v:+ARG}" are erroneously required to be paired |
| Date | Wed, 18 Jul 2018 14:25:03 +0200 |
| Lines | 32 |
| Approved | bug-bash@gnu.org |
| Message-ID | <mailman.3754.1531916712.1292.bug-bash@gnu.org> (permalink) |
| NNTP-Posting-Host | lists.gnu.org |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Trace | usenet.stanford.edu 1531916712 17225 208.118.235.17 (18 Jul 2018 12:25:12 GMT) |
| X-Complaints-To | action@cs.stanford.edu |
| To | bug-bash@gnu.org |
| Envelope-to | bug-bash@gnu.org |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 |
| Content-Language | en-US |
| X-Scanned-By | MIMEDefang 2.78 on 10.11.54.4 |
| X-Greylist | Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 18 Jul 2018 12:25:04 +0000 (UTC) |
| X-Greylist | inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 18 Jul 2018 12:25:04 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'dvlasenk@redhat.com' RCPT:'' |
| X-detected-operating-system | by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] |
| X-Received-From | 66.187.233.73 |
| 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:14358 |
Show key headers only | View raw
Unquoted ${v:+ARG} operator allows single-quoted strings
in ARG:
$ x=a; echo ${x:+'b c'}
b c
In this case, obviously single quotes must be paired.
If ${v:+ARG} is in double-quoted string, single quotes lose their special status:
$ x=a; echo "${x:+'b c'}"
'b c'
IOW: they work similarly to ordinary dquoted strings: echo "It's sunny"
treats single quote as ordinary char.
However, bash errors out if they are not paired:
$ x=a; echo "${x:+'b c}"
> <------------- bash thinks 'str' did not end yet
Most other shells - dash, mksh, busybox ash, posh, bosh -
do not require paired single quotes in this case:
$ dash
$ x=a; echo "${x:+'b c}"
'b c
From all tested shells, only yash behaves like bash.
I think it's a bug.
Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread
Single quotes in ARG in "${v:+ARG}" are erroneously required to be paired Denys Vlasenko <dvlasenk@redhat.com> - 2018-07-18 14:25 +0200
csiph-web