Re: [PATCH] virsh: Treat \n like ; in batch mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 2/21/19 1:55 PM, Eric Blake wrote:
> I wanted to do a demonstration with virsh batch mode, which
> takes multiple commands all packed into a single argument:
> 
> $ virsh -c test:///default 'echo a; echo b;'
> a
> b
> 
> but that produced a really long line, so I tried to make it
> more legible:
> 
> $ virsh -c test:///default '
>    echo a;
>    echo b;
> '
> error: unknown command: '
> '
> 
> Let's be more like the shell, and treat unquoted newline as a
> command separator just as we do for semicolon.  In fact, with
> that, I can even now mix styles:
> 
> $ virsh -c test:///default '
>    echo a; echo b
>    echo c
> '
> a
> b
> c
> 
> Fix the grammer in a nearby comment while at it.
> 
> Signed-off-by: Eric Blake <eblake@xxxxxxxxxx>
> ---
>  tools/virsh.pod      | 4 ++--
>  tools/virt-admin.pod | 4 ++--
>  tools/vsh.c          | 6 +++---
>  3 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/tools/virsh.pod b/tools/virsh.pod
> index 67edb57b14..2bf1ee77bb 100644
> --- a/tools/virsh.pod
> +++ b/tools/virsh.pod
> @@ -40,8 +40,8 @@ as a name.
>  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

s/whitespace, and/whitespace and/

> +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
> diff --git a/tools/virt-admin.pod b/tools/virt-admin.pod
> index 3ddbbff934..b2c9a1db6d 100644
> --- a/tools/virt-admin.pod
> +++ b/tools/virt-admin.pod
> @@ -23,8 +23,8 @@ Where I<command> is one of the commands listed below.
>  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

s/whitespace, and/whitespace and/

Reviewed-by: John Ferlan <jferlan@xxxxxxxxxx>

John

> +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

[...]

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux