working with env vars;rewriting my personal shell scripts
This commit is contained in:
parent
0df0a063b4
commit
989c858e80
53
projects/oorexx/envvars.rex
Executable file
53
projects/oorexx/envvars.rex
Executable file
@ -0,0 +1,53 @@
|
|||||||
|
#!/usr/bin/env rexx
|
||||||
|
|
||||||
|
parse source os .
|
||||||
|
if os~startsWith("Win") then command='set'
|
||||||
|
else command='env | sort -f'
|
||||||
|
|
||||||
|
say "operating system: "os', command was: "'command'"'
|
||||||
|
Say "---"
|
||||||
|
call env_with_array
|
||||||
|
Say "---"
|
||||||
|
call env_with_stem
|
||||||
|
|
||||||
|
Exit
|
||||||
|
|
||||||
|
env_with_array:
|
||||||
|
Say "Getting Environment Vars Using Array:"
|
||||||
|
vars=.array~new
|
||||||
|
address system command with output using (vars)
|
||||||
|
len=vars~items~length
|
||||||
|
say "Number of env vars: "||vars~items
|
||||||
|
|
||||||
|
if rc=0 then
|
||||||
|
do counter i var over vars
|
||||||
|
select
|
||||||
|
when var~startsWith("PWD") then parse var var . "=" pwd
|
||||||
|
when var~startsWith("HOME") then parse var var . "=" home
|
||||||
|
when var~startsWith("SHELL") then parse var var . "=" shell
|
||||||
|
otherwise nop
|
||||||
|
end /* select */
|
||||||
|
end
|
||||||
|
say home
|
||||||
|
say pwd
|
||||||
|
say shell
|
||||||
|
|
||||||
|
Return
|
||||||
|
|
||||||
|
env_with_stem:
|
||||||
|
Say "Getting Environment Vars Using STEM: "
|
||||||
|
address system command with output stem env.
|
||||||
|
say "Number of env vars: "||env.0
|
||||||
|
|
||||||
|
Do i = 1 to env.0
|
||||||
|
select
|
||||||
|
when env.i~startsWith("PWD") then parse var env.i . "=" pwd
|
||||||
|
when env.i~startsWith("HOME") then parse var env.i . "=" home
|
||||||
|
when env.i~startsWith("SHELL") then parse var env.i . "=" shell
|
||||||
|
otherwise nop
|
||||||
|
end/* select*/
|
||||||
|
End
|
||||||
|
say home
|
||||||
|
say pwd
|
||||||
|
say shell
|
||||||
|
Return
|
13
projects/oorexx/memo.rex
Executable file
13
projects/oorexx/memo.rex
Executable file
@ -0,0 +1,13 @@
|
|||||||
|
#!/usr/bin/env rexx
|
||||||
|
address system "echo $HOME" with output stem home.
|
||||||
|
|
||||||
|
parse arg note
|
||||||
|
if note \= "" then note = changestr(" ",note,"_")
|
||||||
|
else note = "text_memo"
|
||||||
|
|
||||||
|
filename=home.1,
|
||||||
|
||"/Documents/memos/",
|
||||||
|
||changestr("-",date("I"),"")||"_",
|
||||||
|
||changestr(":",time(),"")||"_"||note||".md"
|
||||||
|
|
||||||
|
address system "tilde "||filename
|
4
projects/oorexx/wx.rex
Executable file
4
projects/oorexx/wx.rex
Executable file
@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/env rexx
|
||||||
|
parse arg loc
|
||||||
|
if loc = "" then loc="Cowley,UK"
|
||||||
|
Address system "ansiweather -l "||loc||" -u imperial -s true -i false -a true"
|
Loading…
Reference in New Issue
Block a user