On Wed, Jul 29, 2015 at 04:18:02PM +0800, Yu Liu wrote: [...] > Let's make an example: > > #guestfish -a disk.img > >run > >mount /dev/sda1 / > >write-append /a.txt "Hello\n" > >write-append /a.txt "World\n" > >cat /a.txt > Hello > World > > >quit > > Another try: > eval `guestfish --listen` > guestfish --remote add disk.img > guestfish --remote run > guestfish --remote mount /dev/sda1 / > guestfish --remote write-append /a.txt "Hello\n" > guestfish --remote write-append /a.txt "World\n" > guestfish --remote cat /a.txt > Hello\nWorld\n > > # > libguestfs-1.20.11-11.el6.x86_64
The problem is that \n is handled "specially" by guestfish when it is reading the ><fs> command line, but not when it is parsing commands sent via --remote. The way to do this is: $ guestfish --remote write /a.txt "hello world" $ guestfish --remote cat /a.txt hello world Note that you have to actually press the [Return] key after "hello Probably a better plan is to use something like python remoting: https://rwmj.wordpress.com/2013/05/07/using-libguestfs-remotely-with-python-and-rpyc/#content which will be more predictable. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-builder quickly builds VMs from scratch http://libguestfs.org/virt-builder.1.html _______________________________________________ Libguestfs mailing list [email protected] https://www.redhat.com/mailman/listinfo/libguestfs
