Reputation: 1051
I'm trying to compose up a docker-compose file and there is one step where I ran grep -v '^#' .env
to get all the uncommented lines from .env
file to set environment variables.
In the .env
file, it looks like this
DB_ENGINE=django.db.backends.postgresql
However, after running grep -v '^#' .env
and I check the environment, variable DB_ENGINE
has value of "django.db.backends.postgresql\r"
(notice the trailing \r
there).
How can I overcome this? I've been doing this for a long time and it has never happened before.
Upvotes: 2
Views: 74
Reputation: 1327784
Without trying a dos2unix on all your files, you could simply remove any \
r from your grep result, as in here, with:
grep -v '^#' .env| tr -d '\r'
Upvotes: 1