A NOTE has been added to this issue. 
====================================================================== 
http://austingroupbugs.net/view.php?id=1190 
====================================================================== 
Reported By:                geoffclare
Assigned To:                
====================================================================== 
Project:                    1003.1(2016)/Issue7+TC2
Issue ID:                   1190
Category:                   Base Definitions and Headers
Type:                       Clarification Requested
Severity:                   Comment
Priority:                   normal
Status:                     New
Name:                       Geoff Clare 
Organization:               The Open Group 
User Reference:              
Section:                    9.3.5 
Page Number:                184 
Line Number:                6089 
Interp Status:              --- 
Final Accepted Text:         
====================================================================== 
Date Submitted:             2018-04-13 11:16 UTC
Last Modified:              2018-04-16 11:06 UTC
====================================================================== 
Summary:                    backslash has two special meanings in the shell and
only loses one of them in bracket expressions
====================================================================== 

---------------------------------------------------------------------- 
 (0003960) stephane (reporter) - 2018-04-16 11:06
 http://austingroupbugs.net/view.php?id=1190#c3960 
---------------------------------------------------------------------- 
That's wrong for shell pattern matching. As I said earlier, backslash is
not a pattern matching operator in shell wildcards (not any more than ' or
"), it's only a quoting operator and quoting disables wildcard operators.

For instance,

<pre>
pattern='\*'
case $string in
  $pattern) echo something;;
esac
</pre>

Matches on any string that starts with backslash, not on a literal star (at
least in Bourne/ksh/ash/pdksh, not in zsh nor bash, probably a bug as they
match on none of *, \*, \x)

That's different for

<pre>
find . -name '\*'
</pre>

Which matches on files called literally "*" (same as -name '[*]') as in
fnmatch() backslash is used as an ersatz of shell quoting.

Also note that $ loses its special meaning inside [...] in ERE (in BRE, is
loses it already by not being the last character of the RE). 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2018-04-13 11:16 geoffclare     New Issue                                    
2018-04-13 11:16 geoffclare     Name                      => Geoff Clare     
2018-04-13 11:16 geoffclare     Organization              => The Open Group  
2018-04-13 11:16 geoffclare     Section                   => 9.3.5           
2018-04-13 11:16 geoffclare     Page Number               => 184             
2018-04-13 11:16 geoffclare     Line Number               => 6089            
2018-04-13 11:16 geoffclare     Interp Status             => ---             
2018-04-13 11:18 geoffclare     Desired Action Updated                       
2018-04-13 12:39 kre            Note Added: 0003954                          
2018-04-13 13:47 geoffclare     Note Added: 0003955                          
2018-04-14 17:17 stephane       Note Added: 0003957                          
2018-04-16 08:31 geoffclare     Note Added: 0003958                          
2018-04-16 09:23 geoffclare     Note Added: 0003959                          
2018-04-16 09:25 geoffclare     Note Edited: 0003959                         
2018-04-16 11:06 stephane       Note Added: 0003960                          
======================================================================


Reply via email to