I have this bash script:
#!/bin/sh -eux
. ./.env
What does the second line do?
It seems to be impossible to google such syntax :)
I have this bash script:
#!/bin/sh -eux
. ./.env
What does the second line do?
It seems to be impossible to google such syntax :)
Regarding the dot:
. (source or dot operator)
Read and execute commands from the filename argument in the current shell context.
Syntax . filename [arguments]
source filename [arguments]
source is a synonym for dot/period '.' in bash, but not in POSIX sh, so for maximum compatibility use the period.
And regarding
./.env
That is a hidden file (starts with a dot) called .env
in the current directory (./
)
Basically this command sources the file .env
and from the filename you can assume it reloads environment variables. It is equivalent to
source ./.env