mirror of
https://github.com/ENSL/ensl.org.git
synced 2025-01-12 21:00:58 +00:00
21 lines
No EOL
453 B
Fish
21 lines
No EOL
453 B
Fish
#!/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 |