mirror of
https://github.com/ENSL/ensl.org.git
synced 2025-01-30 13:10:42 +00:00
Add fish version of env.sh
This commit is contained in:
parent
bf7815e7ec
commit
38b58cb4a9
1 changed files with 21 additions and 0 deletions
21
script/env.fish
Normal file
21
script/env.fish
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
#!/usr/bin/fish
|
||||||
|
# use source script/env.fish
|
||||||
|
|
||||||
|
if test (count $argv) = 0
|
||||||
|
set -a argv ".env"
|
||||||
|
end
|
||||||
|
|
||||||
|
for FILE in $argv
|
||||||
|
echo "Loading and EXPORTING env vars from: $FILE"
|
||||||
|
echo "---"
|
||||||
|
set ARGS (cat $FILE |grep -vE '^[[:space:]]*(#.*)*$')
|
||||||
|
|
||||||
|
for ARG in $ARGS
|
||||||
|
# echo $ARG
|
||||||
|
set KEY (echo $ARG|sed -nr 's/(.*)=(.*)/\1/p')
|
||||||
|
set VAL (echo $ARG|sed -nr 's/(.*)=(.*)/\2/p')
|
||||||
|
printf "%-30s %-30s\n" $KEY $VAL
|
||||||
|
set -x $KEY "$VAL"
|
||||||
|
end
|
||||||
|
echo
|
||||||
|
end
|
Loading…
Reference in a new issue