I am looking for output of Unix command to be stored in any variable. Generally we use POST process to do so , however , as this is "INCLUDE" object I am not able to store.PUT_VAR does not work as that stores the command itself - not command output.
:SET &HND# = PREP_PROCESS("&$AGENT#","UNIXCMD",,"CMD=echo $SHELL","UC_LOGIN=&$LOGIN#"):PROCESS &HND#: SET &SHELL# = GET_PROCESS_LINE(&HND#): P &SHELL#:ENDPROCESS
:SET &SHELL# = GET_VAR(VARA.BACKEND.UNIX.CMD):P &SHELL#
:REGISTER_VARIABLE "SHELL#", $SHELL
We had tried BACKEND VARA , however were unclear about the “Result
format” , could you help me with example ? if possible use echo $SHELL or ps –p
Entries in the "Columns" have to follow a certain syntax :
Will return results in a single column named "Result", starting with character '1' and 255 characters long:
You can choose to set different columns with different starting points and lengths so the output is easier to read, and different values can be read with GET_VAR(&HND#,column number) - or PREP_PROCESS_VAR(&HND#,column number).
Syntax has to be like this:
Column1Name:<starting point>(length);Column2Name:<starting point>(length)[Column3Name:<starting point>(length)]...[ColumnNName:<starting point>(length)]
Example : raw command on Linux side
Define columns in the VARA.BACKEND :
and the output will look like this: