Define Class by shell command with no starting slash

From Cfwiki

Jump to: navigation, search

Problem

Classes can be set by the return value of any shell command/script with the syntax

classes:
  myclass = ( '/path/function params' )
  • It seems the decision to execute this as a script is made by looking for a starting slash. No problem so far.
  • But now, imagine you collect your scripts in a certain location and store the location in a variable, say ${workdir}?
classes:   
  myclass = ( '${workdir}/function params' )
  • This will not work, as it seems like the parser will notice the slash too late and will not execute the command.

Solution

  • The solution is to prepend this with '/.'
myclass = ( '/.${workdir}/function params' )  # this resolves to "/./path/function..."
  • Thus, the parser will recognize the slash in time and will execute the shell command, but the path is still valid and the same.

Hope it helps --Svenxy 02:53, 15 August 2007 (EDT)

Personal tools