[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] xl command autocompletion: domain names
On 08/11/13 15:11, Ian Jackson wrote: > John Haxby writes ("Re: [Xen-devel] xl command autocompletion: domain names"): >> > On 06/11/13 17:13, Ian Jackson wrote: >>> > > bash_completion_sudo () { >>> > > if [ x"`whoami`" = xroot ]; then "$@" >>> > > else ${BASH_COMPLETION_SUDO-sudo} "$@"; fi >>> > > } >>> > > bash_completion_sudo xl list >> > >> > It's amazing how old constructs make it into new shell scripts for all >> > the wrong reasons. > ... >> > For some reason there has been a resurgence in the belief that you need >> > the x's _and_ the quotes. You don't. Ideally you'd eschew the archaic >> > construct altogether. > The x's are there in case the string looks like an operator for > test(1). Depending on the exact syntax of the expression inside [ ], > it can be ambiguous. In this case it's OK (I think) but IMO it's a > good habit to always include the x whenever passing string data values > to test(1). > I hadn't thought of that ... Except that test doesn't seem so easily fooled: test -f == root && echo oops if [ -f == root ]; then echo oops; fi if [ -f /etc/passwd ]; then echo phew; fi At least that's the case for bash; dash doesn't like it. Still, that's today's new Linux/Unix thing so I'm happy! jch _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |