[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Variables: ${}

From: paguerlais
Subject: Re: Variables: ${}
Date: Fri, 20 Jan 2006 08:54:05 +0100

I use the () form for cfengine variables, to distinguish them with shell
variables. This is especially true for shellcommands.
The trick is that cfengine tries first to resolve the variable as a
cfengine variable. If it can't, it then passes the string $... to the
shellcommand, which has to resolve it. If you use () for cfengine variables
and mistype a variable name, cfagent willt not achieve and and rely on the
shell to deal with it. The shell will then fail.
Little precision : I works perfectly with bourne-shell, I don't know with

      "/some/command $(cfengine_variable) ${shell_variable}"


             Jeremy Mates                                              
             Envoyé par :                                                A
             help-cfengine-bou         address@hidden           
             nces+paguerlais=a                                          cc
             rg                                                      Objet
                                       Re: Variables: ${}              
             20/01/2006 05:04                                          

* Atom Powers <address@hidden>
> What is the recommended way to express variables?
> Most of the time I use $(variable) but I've seen some cases where
> ${variable} is required.
> Are there any cases where $(variable) is required?

I always use ${variable}, as this provides visual contrast with the
Function() and ( class definition ) uses.

Help-cfengine mailing list

reply via email to

[Prev in Thread] Current Thread [Next in Thread]