On 03/21/2013 07:33 PM, Zhang Xiaohe wrote: > 于 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? wordexp() is not portable to mingw, and not provided by gnulib. If you try to use wordexp(), you will basically be re-writing a big chunk of /bin/sh. At this point, I'm not sure it's worth the complexity. Interactive virsh does not need to be a full-blown shell. From the command line, you already have the shell parsing things before handing it to virsh. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Attachment:
signature.asc
Description: OpenPGP digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list