hush: fix eval 'echo ok\'
function old new delta parse_stream 2762 2753 -9 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
92a930b4e8
commit
bcf56114fa
14
shell/hush.c
14
shell/hush.c
@ -5379,15 +5379,19 @@ static struct pipe *parse_stream(char **pstring,
|
||||
continue; /* get next char */
|
||||
case '\\':
|
||||
/*nommu_addchr(&ctx.as_string, '\\'); - already done */
|
||||
o_addchr(&ctx.word, '\\');
|
||||
ch = i_getch(input);
|
||||
if (ch == EOF) {
|
||||
//TODO: in ". FILE" containing "cmd\" (no newline) bash ignores last "\"
|
||||
syntax_error("\\<eof>");
|
||||
xfunc_die();
|
||||
/* Ignore this '\'. Testcase: eval 'echo Ok\' */
|
||||
#if !BB_MMU
|
||||
/* Remove trailing '\' from ctx.as_string */
|
||||
ctx.as_string.data[--ctx.as_string.length] = '\0';
|
||||
#endif
|
||||
continue; /* get next char */
|
||||
}
|
||||
o_addchr(&ctx.word, '\\');
|
||||
/* Example: echo Hello \2>file
|
||||
* we need to know that word 2 is quoted */
|
||||
* we need to know that word 2 is quoted
|
||||
*/
|
||||
ctx.word.has_quoted_part = 1;
|
||||
nommu_addchr(&ctx.as_string, ch);
|
||||
o_addchr(&ctx.word, ch);
|
||||
|
1
shell/hush_test/hush-parsing/bkslash_eof1.right
Normal file
1
shell/hush_test/hush-parsing/bkslash_eof1.right
Normal file
@ -0,0 +1 @@
|
||||
ok
|
1
shell/hush_test/hush-parsing/bkslash_eof1.tests
Executable file
1
shell/hush_test/hush-parsing/bkslash_eof1.tests
Executable file
@ -0,0 +1 @@
|
||||
eval 'echo ok\'
|
Loading…
Reference in New Issue
Block a user