Patch from Matt Kraai to fox sh.c escape problem such that

running things like 'echo "\n\tHi\n\t\!"' and 'echo -e "\n\tHi\n\t\!"'
behave as under bash.
This commit is contained in:
Eric Andersen 2000-12-11 19:14:40 +00:00
parent 59ec601b8e
commit b2356f6de9
3 changed files with 9 additions and 3 deletions

4
lash.c
View File

@ -933,8 +933,10 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi
}
/* in shell, "\'" should yield \' */
if (*src != quote)
if (*src != quote) {
*buf++ = '\\';
*buf++ = '\\';
}
} else if (*src == '*' || *src == '?' || *src == '[' ||
*src == ']') *buf++ = '\\';
*buf++ = *src;

4
sh.c
View File

@ -933,8 +933,10 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi
}
/* in shell, "\'" should yield \' */
if (*src != quote)
if (*src != quote) {
*buf++ = '\\';
*buf++ = '\\';
}
} else if (*src == '*' || *src == '?' || *src == '[' ||
*src == ']') *buf++ = '\\';
*buf++ = *src;

View File

@ -933,8 +933,10 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi
}
/* in shell, "\'" should yield \' */
if (*src != quote)
if (*src != quote) {
*buf++ = '\\';
*buf++ = '\\';
}
} else if (*src == '*' || *src == '?' || *src == '[' ||
*src == ']') *buf++ = '\\';
*buf++ = *src;