Welcome, Guest. Please login or register.

Login with username, password and session length
Pages: [1]   Go Down
Print
Author Topic: setting environment variable from output processing  (Read 1195 times)
0 Members and 1 Guest are viewing this topic.
hjkelsheimer
Member

Posts: 28


View Profile WWW
« on: September 30, 2008, 09:20:28 PM »

can anyone give me an example of how to set an environmental variable from filepro to be used in a script file.

i am working on a customers old fc5 with an old fp 4.5. the variable itself will have a variable in it. i think it is something like this.

"direct" is a word
"2" is a variable number represented by rzv- this number represents up to 6 serial ports to connect to a bank credit card authorization and changes with each dial of the modem

rzv has previously been declared a global i.e. declare global rzv
rzv=rz (regular variable)= i.e "2"

syscall="DIAL="direct{rzv";export DIAL"

the script is not recognizing DIAL-but works if i substiute the actual "direct2" for $s1 variable in the script etc.

can anyone help me please!! i would appreciate any input, info, howto, samples or suggestions

thanks

my email is hjk@mgmtkoncepts.com or hjk@finckcigarcompany.com
 

hubert
Logged
kenbrody
Administrator

Posts: 82


View Profile
« Reply #1 on: March 10, 2009, 12:19:27 PM »

Did you ever get an answer elsewhere?

You don't show your actual SYSTEM commands, but I am guessing that you are setting the environment variable in one SYSTEM call, and then executing your script in a separate call.

That won't work.  What happens is the first SYSTEM call starts a shell, which sets the variable, and the exits.  The second SYSTEM call then starts a new shell (one without the new variable set) and runs your script.

You would need to set the variable and run your script from with the same SYSTEM call, as in:

    SYSTEM "foo=bar ; export foo ; my_script"
Logged

Kenneth Brody
aka "Mr. filePro"  :-)
Pages: [1]   Go Up
Print
Jump to:  

Valid XHTML 1.0! Powered by SMF 1.1.15 | SMF © 2011, Simple Machines | Massive Blue Theme By Cadosoas Valid CSS!