How to use UNIX Command Substitution in a Global Variable

Document ID : KB000014596
Last Modified Date : 14/02/2018
Show Technical Document Details
Question:

How can you set a Global Variable with UNIX command substitution so that the actual command substitution is stored as the value rather than the result of the command substitution?

Answer:

If you are setting the global variable in WCC via Quick Edit, there is nothing special that would need to be done. Just set the value to `<command>`. However, if you are setting the global variable using the sendevent command, you will need to escape the backticks. For example...

sendevent -E SET_GLOBAL -G "<VAR_NAME>=\`<command>\`"