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 12: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:
> 

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

Hmm - if we REALLY want to be more like the shell, then we should also
fix the parser to elide backslash-newline pairs, to allow splitting long
commands without turning them into multiple commands. Right now, we are
treating them as quoted newlines (here, the second echo is called with
four arguments, 'b', $'\n', 'echo', and 'c'), rather than as command
separators (three echos) or elided (the second echo would have just
three arguments, 'b', 'echo', 'c'):

$ tools/virsh -c test:///default '
  echo a; echo b \
  echo c
'
a
b
 echo c

I guess that can be a followup patch.

> 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(-)
> 

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org


[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