IRC question: the proper way to break multiple lines when using virt-sysprep --commands-from-file?
<fs> cat /testfile
<fs> cat /anotherfile
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 this is line 1 this is line 2 this is line 3 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
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
<fs> cat /testfile
<fs> cat /anotherfile
$ guestfish --ro -a fedora-25.img -i this is line 1 this is line 2 this is line 3 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
participants (2)
-
Nadav Goldin -
Richard W.M. Jones