Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
143 user(s) are online (95 user(s) are browsing Forums)

Members: 1
Guests: 142

samo79, more...

Headlines

 
  Register To Post  

DOS multiline variables
Just can't stay away
Just can't stay away


See User information
It seems to me that set and setenv scripting commands do not permit to define a multiline variable.s.
Is this correct?


Go to top
Re: DOS multiline variables
Just can't stay away
Just can't stay away


See User information
@JosDuchIt

> setenv test "line 1*Nline 2*Nline 3"
> getenv test
line 1
> echo >env:test "line 1*Nline 2*Nline 3"
> getenv test
line 1
> type env:test
line 1
line 2
line 3
> set test "line 1*Nline 2*Nline 3"
> get test
line 1
> echo $test
line 1

Correct as you can see from the tests above. you would have to do it the naughty way for setenv and open a file directly. same for reading it as getenv only returns the first line. multiline files should really be kept in progdir:

The other way is to have each vaiable in a seperate env var in it's own drawer eg.

setenv myprog/var1 fred
setenv myprog/var2 derf
etc.

You can save multiple variables in one line though and use cut to return the ones you want. It's easier if you use a custom seperator eg. ^

For example:

> set test "Var 1^Var 2^Var 3"
> cut "$test" W 1 S "^"
Var 1
> cut "$test" W 2 S "^"
Var 2

Treat set as the old basic command let. if you need more complex variables then it's time to forget dos scripts and use arexx or python. Once you get the hang of it python is far easier than arexx.

There may be other things you can try but as I don't know what you're tying to do I can't help much.

Amiga user since 1985
AOS4, A-EON, IBrowse & Alinea Betatester

Ps. I hate the new amigans website. <shudder>
Go to top
Re: DOS multiline variables
Just can't stay away
Just can't stay away


See User information
@Severin: thanks.
at least i learned why \n did not work in
>echo "1\n2\n3"

i am not trying to push DOS to its limits. I use Gui4Cli as a scripting language (and am maintaining its source) - the lack of interest is a real pity because it is the easiest wayt for a non-programmer-to really come to grips with the Amiga.
I am trying to understand why the possibility to read & write env variables as a file is discouraged. After all most of the prefs files in envarc: are multiline files, What we call local & global environmental(?) variables are just DOS (script) variables and DOS main purpose is handling files, right?

If in DOS scripts it becomes that weird to use only set/get/setenv/getenv at least multiline correspondent commands and a scanvars command should be made available.







Edited by JosDuchIt on 2015/7/29 18:48:34
Go to top
Re: DOS multiline variables
Just can't stay away
Just can't stay away


See User information
Yeah, set/get for local, setenv/getenv for global variables. These commands haven't changed in the last 20 years, and iirc then it was only the save option added to setenv.

I tried GUI4CLI a very long time ago but never really got anywhere with it, same with proaction which is more dev than user friendly. Most of the time if I'm writing a script I don't need a gui. If I do need a GUI then it's probably too complicated for CLI to handle anyway so I write something in amiblitz.

Amiga user since 1985
AOS4, A-EON, IBrowse & Alinea Betatester

Ps. I hate the new amigans website. <shudder>
Go to top
Re: DOS multiline variables
Just can't stay away
Just can't stay away


See User information
@Severin
Never tried Amiblitz, so i don't know what it could have more than Gui4Cli.
Too much people think Gui4Cli is just some Gui- builder that launches CLI scripts or commands. This is utterly wrong,:It is a basic-like language with some outstanding characteristics.
- of courseit has a CLI, a RUN, but also a Launch (which detaches the cimmand too as RUN does, but with an xONRETURN eventt command
- event driven command sequences (as in Javascript)
- copy-pasting gadgets from running Gui's
- very powerwerfull variable system permitting as well easy isolation as communication between gui's $Thisgui/ItsVar[3][2] is the most general form.. From within the ThisGui script it is addressable as $ItsVar?





Edited by JosDuchIt on 2015/7/30 6:40:02
Edited by JosDuchIt on 2015/7/30 6:41:09
Go to top
Re: DOS multiline variables
Just can't stay away
Just can't stay away


See User information
Quote:
Never tried Amiblitz, so i don't know what it could have more than Gui4Cli.


Amiblitz running on 3.x (not so much on os4 due to all the changes) gives you complete and easy access to every system library command and structure etc. If you want to see what it's capable of look at HDRec which is written with it.

Amiga user since 1985
AOS4, A-EON, IBrowse & Alinea Betatester

Ps. I hate the new amigans website. <shudder>
Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2023 The XOOPS Project