I have a shell script that passes the content of a .env
file with grep
export $(grep -v '^#' .env | xargs)
In .env
there's:
PYTHONPATH=$PYTHONPATH:$PWD
however, if I run the command, the $
variable expansion does not take place.
$ echo $PYTHONPATH
$PYTHONPATH:$PWD
How do I force $
variable expansion before it's exported?
An easier way to get such a file into the current context is to source it: . ./.env
. For the vast majority of cases this is equivalent to copy/pasting the code into your script and running it.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments