Ticket #39288

Quotation of patterns is not POSIXly correct

Open Date: 2019-06-02 16:27 Last Update: 2019-06-09 11:43

Reporter:
Owner:
Type:
Status:
Open [Owner assigned]
Component:
MileStone:
(None)
Priority:
5 - Medium
Severity:
5 - Medium
Resolution:
None
File:
None
Vote
Score: 0
No votes
0.0% (0/0)
0.0% (0/0)

Details

var="\z"
case ${var} in
(${var}) printf M;;
(*) printf X;;
esac

This should not match because the backslash in the pattern should be special (an escape character).

Ticket History (3/3 Histories)

2019-06-02 16:27 Updated by: magicant
  • New Ticket "Quotation of patterns is not POSIXly correct" created
2019-06-02 16:35 Updated by: magicant
Comment

Other examples

P="x\?x"; var='x?xyyy';printf '%s\n' ${var#${P}}
P="x\?x"; var='x?xyyy';printf '%s\n' "${var#${P}}"
P="\[a]"; var='[a]bc';printf '%s\n' ${var#$P}
P="\\[a]"; var='[a]bc';printf '%s\n' ${var#$P}
P="\\?"; var='1-2-3-\?';printf '%s\n' ${var%-${P}}
2019-06-09 11:43 Updated by: magicant
  • Owner Update from (None) to magicant
  • Component Update from (None) to shell-main

Attachment File List

No attachments

Edit

You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » Login