Forked from apolopena/bash-set-and-unset-env-from-file.sh
Last active
July 26, 2022 18:24
-
-
Save gilvaju/33c13dedd8a79841a454695e909be608 to your computer and use it in GitHub Desktop.
Set and unset environment variables from an .env file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# set environment vars from an .env file | |
export $(grep -v '^#' .myenvfile | xargs) | |
# unset environment vars from an .env file | |
unset $(grep -v '^#' .myenvfile | awk 'BEGIN { FS = "=" } ; { print $1 }') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment