Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error while trying to run a script in cygwin

unexpected end of file. now I did a search on the error and I understand that my script file (that was created in windows) has wrong endings. I also read that I can use dos2unix command on the file to fix this. however, I've tried that and cygwin tells me:

-bash: dos2unix: command not found

other than cygwin I work on a remote unix terminal, on which my script runs fine and there is even a dos2unix command. I've used it on the script file, and tried to use the converted file in cygwin with the same unexpected end of file error. so what are my options?

like image 859
littlerunaway Avatar asked Apr 24 '26 21:04

littlerunaway


1 Answers

You can install dos2unix from the cygwin setup utility

But, this should work too:

sed -i 's/\r$//' file

However, "unexpected end of file" often means you have an open quote (or brace or parenthesis) with no close quote (or brace or parenthesis)

like image 72
glenn jackman Avatar answered Apr 28 '26 10:04

glenn jackman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!