When I load my environment variables using export $(cat .env | xargs)
they all end in with '\r'. Is there a simple way I can fix this? I am using pyvenv if that matters.
Asked
Active
Viewed 708 times
2

Rob
- 3,333
- 5
- 28
- 71
-
1It sounds like the file was edited with a Windows editor, given the lines delimiters of `\r\n` instead of Unix-style `\n`. You can use `dos2unix` to convert the line delimiter. See http://waterlan.home.xs4all.nl/dos2unix.html – Andrew Henle Feb 23 '16 at 10:25
1 Answers
4
I was having this problem. I had set up Ubuntu as my dev environment on Windows to load env variables into my node applications using eval $(cat .env)
but since I was editing my program in vscode for windows, it was still using CRLF endings by default. In order to fix this, I needed to change my vscode settings (CTRL + SHIFT + P, type settings, when the user settings show up, search for EOL and then change it from \r\n to \n) and then the contents of my .env file, delete the .env file, make a new .env file, and paste in the contents of the old .env file.
I hope this was helpful.

Fluffy Ribbit
- 316
- 1
- 4
- 15