Another update from ingydotnet^djgoku

This commit is contained in:
Ingy döt Net 2015-11-18 06:14:39 +00:00
parent 91df62d461
commit 948b86eafa
7604 changed files with 108452 additions and 22726 deletions

View file

@ -1,6 +1,6 @@
{{omit from|TI-83 BASIC}} {{omit from|TI-89 BASIC}} <!-- Does not have an environment other than regular global variables. -->
{{omit from|M4}}
{{omit from|TI-83 BASIC}} {{omit from|TI-89 BASIC}} <!-- Does not have an environment other than regular global variables. -->
{{omit from|Unlambda|Does not provide access to environment variables.}}
{{task|Programming environment operations}}
Show how to get one of your process's [[wp:Environment variable|environment variables]].
The available variables vary by system; some of the common ones available on Unix include PATH, HOME, USER.

View file

@ -2,4 +2,5 @@
category:
- Environment variables
- Initialization
note: Environment variables
- Simple
note: Programming environment operations

View file

@ -1,2 +1 @@
$ awk 'BEGIN{print "HOME:"ENVIRON["HOME"],"USER:"ENVIRON["USER"]}'
HOME:/home/suchrich USER:SuchRich

View file

@ -1,2 +1 @@
$ awk -v h=$HOME -v u=$USER 'BEGIN{print "HOME:"h,"USER:"u}'
HOME:/home/suchrich USER:SuchRich

View file

@ -0,0 +1,5 @@
# http://ideone.com/St5SHF
BEGIN { print "# Environment:"
for (e in ENVIRON) { printf( "%10s = %s\n", e, ENVIRON[e] ) }
}
END { print "# Done." }

View file

@ -0,0 +1 @@
System.get_env("PATH")

View file

@ -0,0 +1,15 @@
MODULE EnvVars EXPORTS Main;
IMPORT IO, Env;
VAR
k, v: TEXT;
BEGIN
IO.Put(Env.Get("HOME") & "\n");
FOR i := 0 TO Env.Count - 1 DO
Env.GetNth(i, k, v);
IO.Put(k & " = " & v & "\n")
END
END EnvVars.