Richard W.M. Jones
2017-May-29 20:39 UTC
[Libguestfs] IRC question: the proper way to break multiple lines when using virt-sysprep --commands-from-file?
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
Nadav Goldin
2017-May-30 11:58 UTC
Re: [Libguestfs] IRC question: the proper way to break multiple lines when using virt-sysprep --commands-from-file?
Thanks. Did the trick On Mon, May 29, 2017 at 11:39 PM, Richard W.M. Jones <rjones@redhat.com> wrote:> > 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 > > _______________________________________________ > Libguestfs mailing list > Libguestfs@redhat.com > https://www.redhat.com/mailman/listinfo/libguestfs