bas-2.5-pw icon indicating copy to clipboard operation
bas-2.5-pw copied to clipboard

ENVIRON/ENVIRON$

Open clasqm opened this issue 4 years ago • 1 comments

Well, one of these three should work, surely?

> shell("pp=test")
> print environ$("pp")

> shell("export pp=test")
> print environ$("pp")

> environ("pp=test")
> print environ$("pp")

> 

This is on a Debian-derived system

clasqm avatar May 22 '20 15:05 clasqm

hmm.. I will have to look into this (I dont have BAS 2.5 setup on this current OS) - appologies for not seeing this sooner

Off the top of my head, none of those SHELL commands will do what you want, they are all siblings and therefore cant affect the parent environment (this is a reflection of SHELL execution, not BAS - its a safety & security measure in POSIX)

FWIW Also SHELL execution does not "pipe back to BAS" (you cant collect return text or error values in a variable). I wanted to fix this at the time, but I did not know how (in a way that works cross platform) - my workaround was to use .OUT hidden files in the current directory, and read thos into a variable.

As far as ENVIRON goes, I used it alot to generate the proper width and height of the interpreter inside a shell/terminal (from './autoexec.bat` - but I did not include that in the repo). What I dont remember is setting anything. However I do know there is a qwirk with the contents of ENVIRON - that maybe I fixed? or this is an example of it being broken (sorry I cant remember more details atm)

I will try an post something back soon

paulwratt avatar Feb 11 '22 03:02 paulwratt