CompuServe Thread

#ADOS Env Variables

6 messages in this thread
#41591From: Ed VishootJun 27, 1994 8:46 AM
I am trying to use gobal environment variables in an AmigaDOS script under WB2.1 and have run into a small problem I would like to find a solution to! I have created a subdirectory in ENV: to neatly place all my variables. The AmigaDOS commands setenv and getenv work just fine but I cannot get the $<variable> function to work. Graphically: setenv EdV/ENVOY Running –> works fine getenv EdV/ENVOY –> works fine echo "$EdV/ENVOY" –> does not return variable value A little experimentation revealed the $<variable> function would only work as long as the <variable> was in the root of ENV: (no subdirectories)! Is there a trick or something I missed about using the $<variable> function? EdV
#41602From: Werner KazmierzakJun 27, 1994 7:23 PM
Ed, no trick that I can help you with. Actually, SETENV [name] [string] will exactly work like ECHO [string] TO ENV:[name], and GETENV [name] will work exactly like TYPE ENV:[name]. So, in [name], you may give an additional path. Whereas $<variable> in the command line will be substituted by the shell process, which scans the given <variable> and will stop the scanning when the first character out of the range [0..9|a..z|A..Z] is encountered. Try the following example to proof this: setenv x single x setenv x.x double x getenv x getenv x.x ;;;; fine ! echo $x echo $x.x ;;;; oops ! So there ist no way to give a path name in <variable>, because only the part before the slash is taken as the name of the variable and the rest is truncated. A multiple assign of ENV: won't help, either. The only work-around I know of is (WB 2.1/3.0) echo `getenv x.x` ;;;; mmmh ! – wkc – … via AP from Hamburg, Germany
#41614From: Ed VishootJun 28, 1994 7:43 AM
Werner, Thanks for the note on $<variable> limitations! I was hoping somebody would know of a work-around based on some fine print in the AmigaDOS manuals that I missed. I guess I could always use an ARexx script to accomplish my goals. Thanks again. EdV
#41628From: Andy FinkelJun 29, 1994 12:57 PM
This works: echo ${EdV/ENVOY} andy
#41639From: Ed VishootJun 30, 1994 8:44 AM
setenv EdV/ToAndy Thanks! echo "Awesome! ${EdV/ToAndy}" EdV
#41640From: Andy FinkelJun 30, 1994 9:36 AM
You're welcome andy