Cache - Set Linux environment variable.

Callout, Caché

Hi,

Is there any way to set environment variables in Linux from Cache?

I see a way to get an environment variable with: $system.Util.GetEnviron()

Essentially I am converting from VMS (DCL) to Linux.

In VMS we used $ZF(-1,"SETSYM") in Cache to a value and then interpreted that value in a DCL procedure.

Actually, I think I should just explained the need. We are writing linux scripts that call cache routines and we would like to pass back a value indicating failure or success to be handle it in the linux script. Right now we are writing out a log file, opening it and searching for a string. Any ideas of how to pass back an exit status to the calling script is helpful.

Thanks.

  • 0
  • 0
  • 135
  • 0
  • 2

Answers

David,

you can try

set rc=$zf(-1,"export MYVAR="_someValue)

while it would hardly work as Caché process environment will be destroyed after the process halt. Honestly, I've never tried it.

I usually use signal files to pass values back from Caché, as it was shown in the 1st sample here: How to return the status code of Cache process to OS shell script?

See Timothy Leavitt's answer to the same post for another option which is more convenient when you are to return numeric values.