Last active
August 23, 2022 23:11
-
-
Save dehidehidehi/6c92f618e4d841e6cc8b2dce8a3b0b7d to your computer and use it in GitHub Desktop.
Python patch-env bash script which cleans .env files from comments and blank lines and allows multiple .env files to be passed as arguments
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
#!/bin/bash | |
# Documentation here : | |
# https://gist.github.com/dehidehidehi/6c92f618e4d841e6cc8b2dce8a3b0b7d | |
# Here's a bash script which would allow to easily concatenate the contents of multiple .env files. | |
# Just save this script and pass the .env file path (relative or absolute) as arguments. | |
ENV_VARS_LIST="" | |
for envFile in $@ | |
do | |
grep -Ev '(#|^$)' $envFile | |
done | |
# Credits: | |
# The base idea for this script is credited to | |
# https://github.com/sterwill | |
# Grep idea is credited to | |
# https://github.com/mousomer |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Examples usage:
patchEnvProvider.sh envfile1.sh envfile2.sh envfile3.sh
Here's a bash script which would allow to easily concatenate the contents of multiple .env files.
Just save this script and pass the .env file path (relative or absolute) as arguments.