Non-Printable Character when creating directory with WSL

28 views Asked by At

First time WSL user. When I run this bash script in WSL that creates a directory there is a non-printable character tacked on to the end.

enter image description here

It doesn't matter if I'm in /mnt/e /mnt/c or mnt/e/some_folder/ same result

My test.sh script-

mkdir myfolder
cd myfolder
export TOP_FOLDER=`pwd`
cd $TOP_FOLDER

The resulting command line-

rayh@computer42:/mnt/e$ bash test.sh
test.sh: line 4: cd: $'/mnt/e/myfolder\r\r\r': No such file or directory
rayh@computer42:/mnt/e$

Any idea what's going on?

Ray

1

There are 1 answers

0
Ray H On

Not very versed in Linux and especially in a mixed environment like WSL. Turns out that I need to have my notepad++ EOL set to UNIX when editing scripts to be run in WSL. Didn't know that. Thanks to user Barmar for pointing me in the right direction.