Answers for "how to get env in linux"

15

linux view environment variables

printenv
Posted by: Guest on May-27-2020
1

linux source env file

# allows you to have empty lines for better readability
eval $(cat .env | sed 's/^/export /')

# Here is another sed solution, which does not run eval or require ruby:
source <(sed -E -n 's/[^#]+/export &/ p' ~/.env)

  # .env contents
  A=1
  #B=2

  # sample run
  $ sed -E -n 's/[^#]+/export &/ p' ~/.env
  export A=1
  #export B=2
Posted by: Guest on October-09-2021

Code answers related to "how to get env in linux"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language