aboutsummaryrefslogtreecommitdiff
path: root/libbb/lineedit.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbb/lineedit.c')
-rw-r--r--libbb/lineedit.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index 68d19e127..e8d721e61 100644
--- a/libbb/lineedit.c
+++ b/libbb/lineedit.c
@@ -1133,7 +1133,16 @@ static void showfiles(void)
1133 1133
1134static const char *is_special_char(char c) 1134static const char *is_special_char(char c)
1135{ 1135{
1136 return strchr(" `\"#$%^&*()=+{}[]:;'|\\<>", c); 1136 // {: It's mandatory to escape { only if entire name is "{"
1137 // (otherwise it's not special. Example: file named "{ "
1138 // can be escaped simply as "{\ "; "{a" or "a{" need no escaping),
1139 // or if shell supports brace expansion
1140 // (ash doesn't, hush optionally does).
1141 // (): unlike {, shell treats () specially even in contexts
1142 // where they clearly are not valid (e.g. "echo )" is an error).
1143 // #: needs escaping to not start a shell comment.
1144 return strchr(" `'\"\\#$~?*[{()&;|<>", c);
1145 // Used to also have %^=+}]: but not necessary to escape?
1137} 1146}
1138 1147
1139static char *quote_special_chars(char *found) 1148static char *quote_special_chars(char *found)