[libvirt] [PATCH] Make virsh support '~' and '$HOME' in interactive mode

Zhang Xiaohe zhangxh at cn.fujitsu.com
Fri Mar 22 01:33:42 UTC 2013


于 2013年03月21日 21:08, Eric Blake 写道:
> On 03/21/2013 04:20 AM, Daniel P. Berrange wrote:
>
> In other words, if we're going to do this, go all the way and use
> wordexp() to get shell-like expansion, instead of reinventing it
> ourselves.  Except that wordexp() is not portable to mingw, and not
> provided in gnulib.
>
>>
>> Also, we'll need a way to escape the special meaning of '~'
>> and '$' to get them treated as literal characters instead of
>> special characters.
>
> We already have the ability to quote characters, so that we can embed
> spaces; our quoting rules are (intentionally) copied on shell rules, so
> they would still work with a wordexp() approach.
>
This seems better than just expanding $HOME, i will try this wordexp().
One question, is variable can be accepted in the position of command
and option? That is, is this form
virsh # $VAR --$OPT=~/rpmbuild
could be valid?





More information about the libvir-list mailing list