sh: Allow quoting ^ and ] in bracket expressions.

This commit is contained in:
Jilles Tjoelker 2011-12-28 23:51:17 +00:00
parent 6e8db49a44
commit 3a1b9c9e82
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=228943
2 changed files with 16 additions and 4 deletions

View File

@ -219,16 +219,16 @@ main(int argc __unused, char **argv __unused)
add("`", "CBQUOTE");
add("$", "CVAR");
add("}", "CENDVAR");
/* ':/' for tilde expansion, '-' for [a\-x] pattern ranges */
add("!*?[=~:/-", "CCTL");
/* ':/' for tilde expansion, '-^]' for [a\-x] pattern ranges */
add("!*?[]=~:/-^", "CCTL");
print("dqsyntax");
init();
fputs("\n/* syntax table used when in single quotes */\n", cfile);
add("\n", "CNL");
add("\\", "CSBACK");
add("'", "CENDQUOTE");
/* ':/' for tilde expansion, '-' for [a\-x] pattern ranges */
add("!*?[=~:/-", "CCTL");
/* ':/' for tilde expansion, '-^]' for [a\-x] pattern ranges */
add("!*?[]=~:/-^", "CCTL");
print("sqsyntax");
init();
fputs("\n/* syntax table used when in arithmetic */\n", cfile);

View File

@ -0,0 +1,12 @@
# $FreeBSD$
case ^ in
[\^^]) ;;
*) echo Failed at $LINENO ;;
esac
case s in
[\^^]) echo Failed at $LINENO ;;
[s\]]) ;;
*) echo Failed at $LINENO ;;
esac