[Libguestfs] IRC question: the proper way to break multiple lines when using virt-sysprep --commands-from-file?

Richard W.M. Jones rjones at redhat.com
Mon May 29 20:39:01 UTC 2017


18:07 < _ng> What is the proper way to break mult lines when using
             virt-sysprep --write option, with --commands-from-file?
             (I don't mean escaping, but actually writing new lines to
             the file)

You can use \ as a continuation character, as it mentions
in the manual.

Using virt-builder (just because it's a bit easier to demonstrate, but
virt-sysprep should work the same way), you can do:

  $ cat test.cmds 
  write /testfile:this is line 1\
  this is line 2\
  this is line 3
  write /anotherfile:this is another command

  $ virt-builder fedora-25 --commands-from-file test.cmds

  $ guestfish --ro -a fedora-25.img -i
  ><fs> cat /testfile 
  this is line 1
  this is line 2
  this is line 3
  ><fs> cat /anotherfile 
  this is another command

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org




More information about the Libguestfs mailing list