#ADOS Env Variables
6 messages in this thread
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
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
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
This works:
echo ${EdV/ENVOY}
andy
setenv EdV/ToAndy Thanks!
echo "Awesome! ${EdV/ToAndy}"
EdV
You're welcome
andy