# Bad interpreter and end of line characters

**URL:** <https://www.ruby-forum.com/t/bad-interpreter-and-end-of-line-characters/94855>\
**Category:** Ruby\
**Created:** [May 16, 2006, 6:09pm UTC](https://www.ruby-forum.com/t/bad-interpreter-and-end-of-line-characters/94855 "2006-05-16T18:09:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![BergerS\_Daniel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bc8723/32.png) [@BergerS\_Daniel](https://www.ruby-forum.com/u/BergerS_Daniel)\
**Post date:** [May 16, 2006, 6:09pm UTC](https://www.ruby-forum.com/t/bad-interpreter-and-end-of-line-characters/94855/1 "2006-05-16T18:09:06Z")

</div>

Hi all,

Check it:

# test1.rb - created via Eclipse on Windows, using UTF8 encoding

#!/usr/bin/ruby

# test2.rb - created via vi on Linux

#!/usr/bin/ruby

> ./test1.rb  
> : bad interpreter: No such file or directory

> ./test2.rb

Hey! WTF?

> od test1.rb  
> 0000000 020443 072457 071163 061057 067151 071057 061165 006571  
> 0000020 000012  
> 0000021

> od test2.rb  
> 0000000 020443 072457 071163 061057 067151 071057 061165 005171  
> 0000020

Normally I can see newlines as ^M characters with vi, but I don’t see  
them, and attempting to replace them doesn’t work.

According to my ASCII chart, 12 is a newline. Ok, I wrote test1.rb on  
Windows. But where the heck is that 21 (device control 1?) coming from?  
Is it the UTF8 encoding? And how do I get rid of it? And why is it  
making Ruby choke?

Thanks,

Dan

This communication is the property of Qwest and may contain confidential  
or  
privileged information. Unauthorized use of this communication is  
strictly  
prohibited and may be unlawful. If you have received this communication  
in error, please immediately notify the sender by reply e-mail and  
destroy  
all copies of the communication and any attachments.

---

<div class="post-metadata">

**Author:** ![BergerS\_Daniel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bc8723/32.png) [@BergerS\_Daniel](https://www.ruby-forum.com/u/BergerS_Daniel)\
**Post date:** [May 16, 2006, 6:30pm UTC](https://www.ruby-forum.com/t/bad-interpreter-and-end-of-line-characters/94855/2 "2006-05-16T18:30:59Z")

</div>

> > > > > “B” == Berger, Daniel [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:

> > od test1.rb  
> > B\> 0000000 020443 072457 071163 061057 067151 071057 061165 006571  
> > B\> 0000020 000012  
> > B\> 0000021

Try

cat -v test1.rb

or

od -b test1.rb

B\> Is it the UTF8 encoding? And how do I get rid of it? And why is it

ruby -pi.bak -e ‘$\_.sub!(/\cM$/, “”)’

Guy Decoux
