Link to home
Start Free TrialLog in
Avatar of techieBrandon
techieBrandonFlag for United States of America

asked on

Jacl script escape '{' to be used inside of a string?

I am looking to use the string ${USER_HOME_DIR} inside a jacl script. I know to escape the $ for processing however jacl still doesn't like my curly brackets since it thinks it is a code block or something. Anyone have insight?

The result will modify a websphere environment variable, I understand this can probably be done in jython but I am restricted to jacl.
set nodeName [$AdminControl getNode]
  append node "Node=" $nodeName
  set driverpath "\${USER_INSTALL_ROOT}/serverClasspath"
  set varName "MY_VARIABLE"
  append varAttrs "-scope " $node " -variableName " $varName " -variableValue " $driverpath
  $AdminTask setVariable $varAttrs

Open in new window

Avatar of techieBrandon
techieBrandon
Flag of United States of America image

ASKER

I am special...

http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/topic/com.ibm.websphere.express.doc/info/exp/ae/ccws_variable.html

The value of a configuration attribute can contain references to one or more variables. The syntax for such an attribute is the name of the variable, enclosed in either a pair of curly braces { } or a pair of parenthesis ( ). In either case, the variable is proceeded by the dollar sign.
ASKER CERTIFIED SOLUTION
Avatar of HonorGod
HonorGod
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
 set nodeName [$AdminControl getNode]
  append node "Node=" $nodeName
  set driverpath "\$(USER_INSTALL_ROOT)/serverClasspath"
  set varName "MY_VARIABLE"
  append varAttrs "-scope " $node " -variableName " $varName " -variableValue " $driverpath
  $AdminTask setVariable $varAttrs
HonorGod,

I had attempted that, no joy
I'm sorry.  I don't understand your update.

Can you use the backslash to allow the open curly brace, or open parenthesis to be in your string?
What do you expect the value to be?


wsadmin>set driverpath "\$(USER_INSTALL_ROOT)/serverClasspath"
$(USER_INSTALL_ROOT)/serverClasspath
wsadmin>puts $driverpath
$(USER_INSTALL_ROOT)/serverClasspath
 
wsadmin>

Open in new window

I expect the value to be $(USER_INSTALL_ROOT), however that is fine since WAS will accept that in place of ${USER_INSTALL_ROOT}. However I am still curious why \$\{USER_INSTALL_ROOT\} was not acceptable. However it might have more to do with wsadmin and less to do with jacls interpretation of it.
Well, as you can see in http://#a24453077 I used an interactive wsadmin (Jacl) session to show the assignment of the value to "driverpath", and its actual value.

So, is it doing what you expect, or not?

If not, how can I help?
This is correct, however not the solution in regards to use with wsadmin. The solution for using websphere environment variables (generally seen as ${VARIABLE}) it to pass it as $(VARIABLE). Using parenthesis instead of the brackets is acceptable by wsadmin and is still evaluated as the websphere environment variable.
Thanks for the grade & points.

I'm glad to have been able to help in some way.

Good luck & have a great day.