If I redirect the output of a linux command in Cygwin e.g.
ls -l > lsl.txt
the file lsl.txt gets created as expected
But if I do the same in a bash script and call it within Cygwin, what gets created is:
lsl.txt .
This file cannot be opened by most editors, and I’m assuming that operating on it or parsing it programmatically will be troublesome.
What causes this ‘.’ to get appended to the file, and how can I avoid this?
This could be due to Windows line endings (CR-LF) in your bash script. Make sure you are using Unix line endings (LF).