Patch from Matt Kraai to fox sh.c escape problem such that
authorEric Andersen <andersen@codepoet.org>
Mon, 11 Dec 2000 19:14:40 +0000 (19:14 -0000)
committerEric Andersen <andersen@codepoet.org>
Mon, 11 Dec 2000 19:14:40 +0000 (19:14 -0000)
running things like 'echo "\n\tHi\n\t\!"' and 'echo -e "\n\tHi\n\t\!"'
behave as under bash.

lash.c
sh.c
shell/lash.c

diff --git a/lash.c b/lash.c
index 07715d4e305303e0f75ca8bf21c3f8ecb828a7b9..9fc215c9897c5965436c93de42de4ead2e89acb1 100644 (file)
--- a/lash.c
+++ b/lash.c
@@ -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;
diff --git a/sh.c b/sh.c
index 07715d4e305303e0f75ca8bf21c3f8ecb828a7b9..9fc215c9897c5965436c93de42de4ead2e89acb1 100644 (file)
--- a/sh.c
+++ b/sh.c
@@ -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;
index 07715d4e305303e0f75ca8bf21c3f8ecb828a7b9..9fc215c9897c5965436c93de42de4ead2e89acb1 100644 (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;