DO_TEST(34, "hello\n", "echo --str hello");
DO_TEST(35, "hello\n", "echo --hi");
+ /* Tests of multiple commands. */
+ DO_TEST(36, "a\nb\n", " echo a; echo b;");
+ DO_TEST(37, "a\nb\n", "\necho a\n echo b\n");
+
# undef DO_TEST
VIR_FREE(custom_uri);
The B<virsh> program can be used either to run one I<COMMAND> by giving the
command and its arguments on the shell command line, or a I<COMMAND_STRING>
which is a single shell argument consisting of multiple I<COMMAND> actions
-and their arguments joined with whitespace, and separated by semicolons
-between commands. Within I<COMMAND_STRING>, virsh understands the
+and their arguments joined with whitespace and separated by semicolons or
+newlines between commands. Within I<COMMAND_STRING>, virsh understands the
same single, double, and backslash escapes as the shell, although you must
add another layer of shell escaping in creating the single shell argument.
If no command is given in the command line, B<virsh> will then start a minimal
The B<virt-admin> program can be used either to run one I<COMMAND> by giving the
command and its arguments on the shell command line, or a I<COMMAND_STRING>
which is a single shell argument consisting of multiple I<COMMAND> actions
-and their arguments joined with whitespace, and separated by semicolons
-between commands. Within I<COMMAND_STRING>, virt-admin understands the
+and their arguments joined with whitespace and separated by semicolons or
+newlines between commands. Within I<COMMAND_STRING>, virt-admin understands the
same single, double, and backslash escapes as the shell, although you must
add another layer of shell escaping in creating the single shell argument.
If no command is given in the command line, B<virt-admin> will then start a minimal
if (*p == '\0')
return VSH_TK_END;
- if (*p == ';') {
+ if (*p == ';' || *p == '\n') {
parser->pos = ++p; /* = \0 or begin of next command */
return VSH_TK_SUBCMD_END;
}
while (*p) {
/* end of token is blank space or ';' */
if (!double_quote && !single_quote &&
- (*p == ' ' || *p == '\t' || *p == ';'))
+ (*p == ' ' || *p == '\t' || *p == ';' || *p == '\n'))
break;
if (!double_quote && *p == '\'') { /* single quote */