[Libguestfs] \n didn't lead to a new line while using remote model

Yu Liu luis.liu at oracle.com
Thu Jul 30 01:45:38 UTC 2015


Ah, I see. Many thanks.

BTW, I see a function that it can add a ssh remote image, like guestfish 
-a ssh://root@example.com/path/disk.img,  it's really powerful, but why 
couldn't I secceed?

#guestfish -a http://slcn03cn15.us.oracle.com/packages/test1.img
http://slcn03cn15.us.oracle.com/packages/test1.img: No such file or 
directory

On 2015/7/29 20:42, Richard W.M. Jones wrote:
> 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.
>

-- 
Thanks!
Luis Liu




More information about the Libguestfs mailing list