#How input to env. var.?
6 messages in this thread
Is there any standard way in the CLI from a script having the user input
data and store it in an environment variable? The SET/SETENV commands
require the string to be stored to be known beforehand and the ASK command
only allows input of Y/N.
Regards, J0RGEN ….from DENMARK
J0RGEN,
If you can wait a couple more days/weeks, AskEnv from Bengt Giger may be
available to you. I'm in close contact with the author and will upload the
new version here as soon as he's got it finished.
AskEnv allows you to use most OS2.0 gadgets and requesters from AmigaDOS
or ARexx scripts. You can even build your own Window with multiple gadgets
in them. I've already done lots of things with AskEnv including a
replacement for DAAM. Of course, just reading input from a shell can be
done with AskEnv as well (that's the way it started, actually), but having
a System (or Arq) requester get the string looks much more elegant!
Stay tuned for AskEnv to arrive here!
Tom / Amiga Imagineer from Switzerland with AutoPilot engaged
AskEnv sounds fine, but maybe overkill for my purpose. Actually I already
programmed a ReadVar command, which reads a local/global environment
variable from user input. It may supplement the AskEnv command as a minimal
type command.
Regards, J0RGEN
I usually do something like:
echo "Please give your answer " noline set >NIL: answer ?
The redirection keeps you from seeing the template; the noline on the echo
makes the prompt appear on the same line. The ? tells the set command to
take its input from standard input.
andy
Thanks, Andy, but that was a tricky one! However, it works,
but entering a CR only will not clear the variable. It
will still contain its previous value, so you must remember
to issue SET var "" before the SET >NIL: var ? command.
Regards, J0RGEN ….from DENMARK
Or use the UNSET command to remove the previous value.
andy