14482abc9a
Attempt to correctly deal with \ (both when it is a literal, in appropriate cases, and when it appears as CTLESC when it was detected as a quoting character during parsing). In a pattern, in sh, no quoted character can ever be anything other than a literal character. This is quite different than regular expressions, and even different than other uses of glob matching, where shell quoting is not an issue. In something like ls ?\*.c the ? is a meta-character, the * is a literal (it was quoted). This is nothing new, sh has handled that properly for ever. But the same happens with VAR='?\*.c' and ls $VAR which has not always been handled correctly. Of course, in ls "$VAR" nothing in VAR is a meta-character (the entire expansion is quoted) so even the '\' must match literally (or more accurately, no matching happens - VAR simply contains an "unusual" filename). But if it had been ls *"$VAR" then we would be looking for filenames that end with the literal 5 characters that make up $VAR. The same kinds of things are requires of matching patterns in case statements, and sub-strings with the % and # operators in variable expansions. While here, the final remnant of the ancient !! pattern matching hack has been removed (the code that actually implemented it was long gone, but one small piece remained, not doing any real harm, but potentially wasting time - if someone gave a pattern which would once have invoked that hack.) |
||
---|---|---|
.. | ||
cat | ||
chio | ||
chmod | ||
cp | ||
csh | ||
date | ||
dd | ||
df | ||
domainname | ||
echo | ||
ed | ||
expr | ||
hostname | ||
kill | ||
ksh | ||
ln | ||
ls | ||
mkdir | ||
mt | ||
mv | ||
pax | ||
ps | ||
pwd | ||
rcmd | ||
rcp | ||
rm | ||
rmdir | ||
sh | ||
sleep | ||
stty | ||
sync | ||
test | ||
Makefile | ||
Makefile.inc |