transcode-open / apt-cyg

Apt-cyg, an apt-get like tool for Cygwin
MIT License
3k stars 685 forks source link

'^M' in apt-cyg #86

Open ak2766 opened 8 years ago

ak2766 commented 8 years ago

Looks like someone has modified the apt-cyg script on windows and forgot to run dos2unix on the file before committing! I was getting this error when attempting to execute the script:

/usr/local/bin/apt-cyg: line 25: $'\r': command not found
/usr/local/bin/apt-cyg: line 121: syntax error near unexpected token `$'{\r''
'usr/local/bin/apt-cyg: line 121: `function wget {

Fixed by running: sed -i 's/Ctrl+V Enter $//' apt-cyg

transcode-open commented 8 years ago

I tried to duplicate this and could not. Running

dos2unix --info apt-cyg/apt-cyg/apt-cyg

I get

0     673       0  no_bom    text    apt-cyg/apt-cyg/apt-cyg

ie 673 unix line endings, zero of any other type.

ak2766 commented 8 years ago

OK - this is interesting.

I just checked out the code on my Ubuntu desktop and I see no ^M symbols. However, cloning this in cygwin on Windows (where I intend on running it), I see the ^M at the end of each line!

Could be that Git on Windows is converting from unix2dos!

native-api commented 7 years ago

This error happens whenever you save a UNIX script with a program that inserts Windows line endings. That includes git that is configured with core.autocrlf true.

So, not an apt-cyg bug.

armbrusterc commented 7 years ago

As a quick dirty fix for this in windows you can open the apt-cyg file in notepad++ then use the ctrl+f and replace function to remove the "carriage return" \r characters. Select the Regular Expression radio button Find what:\r replace with: replace box should be empty that means no spaces or anything at all. click replace all, then save and try the command again in cygwin

harieamjari commented 5 years ago

As a quick dirty fix for this in windows you can open the apt-cyg file in notepad++ then use the ctrl+f and replace function to remove the "carriage return" \r characters. Select the Regular Expression radio button Find what:\r replace with: replace box should be empty that means no spaces or anything at all. click replace all, then save and try the command again in cygwin

unfortunately i couldnt find any "\r" to replace with. (Oh my god im starting to think about the murphy's law; " Every solution breeds more problems lol)

Syntanyl2 commented 2 years ago

As a quick dirty fix for this in windows you can open the apt-cyg file in notepad++ then use the ctrl+f and replace function to remove the "carriage return" \r characters. Select the Regular Expression radio button Find what:\r replace with: replace box should be empty that means no spaces or anything at all. click replace all, then save and try the command again in cygwin

This did the trick for me, thank you.