Another update from ingydotnet^djgoku
This commit is contained in:
parent
91df62d461
commit
948b86eafa
7604 changed files with 108452 additions and 22726 deletions
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -2,4 +2,5 @@
|
|||
category:
|
||||
- Environment variables
|
||||
- Initialization
|
||||
note: Environment variables
|
||||
- Simple
|
||||
note: Programming environment operations
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
$ awk 'BEGIN{print "HOME:"ENVIRON["HOME"],"USER:"ENVIRON["USER"]}'
|
||||
HOME:/home/suchrich USER:SuchRich
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
$ awk -v h=$HOME -v u=$USER 'BEGIN{print "HOME:"h,"USER:"u}'
|
||||
HOME:/home/suchrich USER:SuchRich
|
||||
|
|
|
|||
|
|
@ -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." }
|
||||
|
|
@ -0,0 +1 @@
|
|||
System.get_env("PATH")
|
||||
|
|
@ -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.
|
||||
Loading…
Add table
Add a link
Reference in a new issue