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
others.

Example
<cfagent>
   shellcommands:
      "/some/command $(cfengine_variable) ${shell_variable}"
</cfagent>

Patrice



                                                                       
             Jeremy Mates                                              
             <[EMAIL PROTECTED]>                                         
             Envoyé par :                                                A
             help-cfengine-bou         help-cfengine@gnu.org           
             nces+paguerlais=a                                          cc
             [EMAIL PROTECTED]                                         
             rg                                                      Objet
                                       Re: Variables: ${}              
                                                                       
             20/01/2006 05:04                                          
                                                                       
                                                                       
                                                                       
                                                                       




* Atom Powers <[EMAIL PROTECTED]>
> 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
Help-cfengine@gnu.org
http://lists.gnu.org/mailman/listinfo/help-cfengine



_______________________________________________
Help-cfengine mailing list
Help-cfengine@gnu.org
http://lists.gnu.org/mailman/listinfo/help-cfengine

Reply via email to