Command
set -a; source .env; set +a;
Example
echo "EXAMPLE1=ABC\nEXAMPLE2=DEF" >> .env
cat .env
EXAMPLE1=ABC
EXAMPLE2=DEF
env | grep EXAMPLE
set -a; source .env; set +a;
env | grep EXAMPLE
EXAMPLE1=ABC
EXAMPLE2=DEF
Ref
NAME
set - Set or unset values of shell options and positional parameters.
SYNOPSIS
set [--abefhkmnptuvxBCHP] [-o option-name] [arg ...]
DESCRIPTION
Set or unset values of shell options and positional parameters.
Change the value of shell attributes and positional parameters, or
display the names and values of shell variables.
Options:
-a Mark variables which are modified or created for export.
http://linuxcommand.org/lc3_man_pages/seth.html
Original by Github issue
https://github.com/YumaInaura/YumaInaura/issues/3007
Recommended Posts