Skip to content

Instantly share code, notes, and snippets.

@fcoclavero
Last active December 20, 2022 02:59
Show Gist options
  • Save fcoclavero/954c2ee064cbbb92ee4af0af2e8b5a3a to your computer and use it in GitHub Desktop.
Save fcoclavero/954c2ee064cbbb92ee4af0af2e8b5a3a to your computer and use it in GitHub Desktop.
Envfiles
# Get value on variable in .env file
cat .env | grep $VAR_NAME | sed 's/.*=//'
# Output contents of .env joined by comma
cat .env | tr '\n' ',' | rev | cut -c2- | rev # cut works on preceding characters, thats why we reverse twice to remove last two characters from tr, which include a trailing comma
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment