[ClusterLabs] Antw: Re: [RFC at agents] unresolved issue with handling parameters containing whitespaces

Ulrich Windl Ulrich.Windl at rz.uni-regensburg.de
Wed May 13 10:05:04 UTC 2015


>>> Vladislav Bogdanov <bubble at hoster-ok.com> schrieb am 13.05.2015 um 10:35 in
Nachricht <55530CB5.7040702 at hoster-ok.com>:

[...]
> It is the safest position to quote variables every time you use them 
> unless you know for sure that in the specific case var should be used 
> unquoted.

Hi!

Unfortunately it's not as easy as it might seem. Consider a variable where multiple values (space separated) may be given, and the user is tempted to use shell syntax like this: "host{h0{1,2,3},v0{4,5,6}}"
Then you'd need
LIST=$(eval echo ${PARAM})
and
command $LIST
without the quotes. Now if you have a space in one of the parameters, ...

Regards,
Ulrich






More information about the Users mailing list