Friday, July 25, 2008

: $'\r': command not found in Cygwin

If you happen to have this kind of error for no reason, please make sure you convert your shell script file to UNIX format using any text editor like Notepad++. Initially it seems like a weird error but yet another valid issue with Cygwin + XP editor.

Here is an example, If you create a script in Notepad++

-------------------------------------------------------------------
#!/bin/bash
#
# My Cygwin weird error
#

clear
echo
"Knowledge is Power"
-------------------------------------------------------------------


When you run this script directly from Cygwin (by editing it from Notepad) you might forget to set the file format to Unix. This often result in following error.

-------------------------------------------------------------------

./print_a_line.sh: line 1: $'\r': command not found
Knowledge is Power

-------------------------------------------------------------------

Or,

You can convert them to UNIX format using shell utility dos2unix

So, Thats it! You are set!

123 comments:

V3 said...

Thanks it really helped !!!

faber said...

lol.. I didn't remember about differences between \n in *nix and windows :D

Thank you ;)

Tim said...

Easiest thing to do:

dos2unix ./*

Will convert all files in the current directory.

Brian Egge said...

If your files are part of a SVN project, you can change the EOL style of the scripts to make them always use LF.

Diego said...

Gracias, estuve todo el día quebrandome la cabeza!!!!! ni siquiera las variables me funcionaban

Jeevan said...

Thanks, I was doing lot of research around this. Really helped.

Anders Grusell said...

Nice tip, thanks a lot dude!

Micha said...

Hello i get this error when trying to make the U_Boot files for any type of processor. I m using WindowsXP, Cygwin and GNUARM. The U_Boot repository i downloaded with standard cofiguration of GIT.
I tried the dos2unix command but it doesnt seem to do anything. Also i am not sure if it is handling recursevly the hundrets of files nad folder i have in the repository. It is not giving any message.

Micha said...

hey i found the error!! git had downloaded the tree with dos ending. I reconfigured git to download with unix ending, and it works. since that command dos2unix didnt work.

z0ltan said...

Thanks, mate! It really helped me configure Hadoop (on a Windows box so I had to use Cygwin). Just one suggestion though - this page was nigh unreadable with the white font on the grey background. Please change it!

Chinmay said...

Hello thanks a lot for ur help.

sandeep said...

dos2unix FILENAMEGOESHERE works like a charm.

aj said...

Thanks.. it did help me..

http://tamilnovelsonline.blogspot.com

Ashish said...

thanks

aroc725 said...

This didn't work for me, don't know why.

aroc725 said...
This comment has been removed by the author.
aroc725 said...

I ended up saving one of the config files in Unix format, since it had been in Windows format for some reason. Anyway, I still get an error message when I try to run a command to return the Hadoop version:


$ bin/hadoop version
cygwin warning:
MS-DOS style path detected: C:\cygwin\usr\local\hadoop\/build/native
Preferred POSIX equivalent is: /usr/local/hadoop/build/native
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
/usr/local/hadoop/bin/hadoop-config.sh: line 190: C:\jdk1.6.0_18: command not found
Hadoop 0.21.0
Subversion https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.21 -
r 985326
Compiled by tomwhite on Tue Aug 17 01:02:28 EDT 2010
From source with checksum a1aeb15b4854808d152989ba76f90fac

BirrNet said...

Thanks

rick said...

i was waiting for this code

Matt Droter said...

Awesome! Thanks for your post.

Marco said...

Thanks! That did the trick for me as well.

Lighstagazi said...

To expand on the Notepad++ problem specifically, you can change it by:
Edit -> EOL Conversion -> UNIX Format

DHAMPU said...

Hi, I am trying to Run Shell script using Cygwin and Java. When i run script on command prompt it works fine but when i m running same script it stops where i am doing dos2unix *.* can you tell me how to avoid this. is there any setting which will allow me to run script directly.

Phenom Jet said...

Thanks! That was helpful.

Unknown said...

Thanks. You rule.

Paul d'Aoust said...

Thanks for posting this for other people to find; this was driving me crazy until I discovered that Geany, my text editor of choice, was indeed saving files with \r\n.

Mathew Stephen said...

I guess you are on the right path, I have configured in your way and its working. But when I am running code , its completing map 100 but reduce 0%/. Please I am facing this issue since long time please help me

Big Data Hadoop Training in Chennai

murali karthik said...

Thanks for your informative post on Java application development. This open source platform assists software developers to create stunning mobile application with ease. Further, they can make use of this platform at free of cost.
Java Training in Chennai
.Net Training in Chennai
PHP Training in Chennai
Big Data Training in Chennai

Arjun kumar said...

Thanks for your wonderful information

Hadoop Course in
Chennai
| Big Data Hadoop Training in Chennai | Hadoop Course in Chennai

Amirtha rao said...

Thanks for sharing this valuable post to my knowledge great pleasure to be here SAS has great scope in IT industry. It’s an application suite that can change, manage & retrieve data from the variety of origin & perform statistical analytic on it…
Regards,
sas training in Chennai|sas course in Chennai|sas training institute in Chennaisas training chennai

jhansi joe said...

This technical post helps me to improve my skills set, thanks for this wonder article I expect your upcoming blog, so keep sharing.
Regards,
ccna course in Chennai|ccna training in Chennai|ccna training institute in Chennai|ccna institutes in Chennai

Le Mu said...

dongtam
mu private
tim phong tro
http://nhatroso.com/
nhac san cuc manh
tổng đài tư vấn luật
http://dichvu.tuvanphapluattructuyen.com/
văn phòng luật
tổng đài tư vấn pháp luật
thành lập công ty
http://we-cooking.com/
chém gió
trung tâm ngoại ngữhuynh nếu không tìm đại tẩu cho muội thì muội cần gì phải gấp gáp tìm muội phu cho huynh.

Nhạc Kiều giương mắt hạnh nhìn về phía Nhạc Long mà nói.

- Tốt lắm, Nhạc gia hôm nay mọi ngươì đã đến buổi tối tụ tập lại, chúng ta hàn huyên mộc chút.

Nhạc Tử Sơn mỉm cười nói.

Mà lúc này, Nhạc Tử Sơn lại nhớ tới Nhạc Thành, tất cả thay đổi này chính là do tên tiểu nhi tử này mang tới.

- Lão gia, không tốt, phía ngoài có người xông vào Phá Quân sơn.

Một tam tinh Đấu hoàng của Phá Quân bang cất tiếng nói.

- Ai dám vào Phá Quân sơn quấy rồi, muốn chết phải không?

Nhạc Kiều chăm chú nhìn tam tinh Đấu Hoàng cất tiếng hỏi.

- Nhạc kiều tiểu thư, sáu lão già thần bí đó vô cùng lợi hại, từ chân núi đánh lên không ai có thể

Jhon anderson said...

Website are the only way to execute a company's projects to their visitors. And it is mandatory to maintain a responsive one as well. Your content explicitly states that. Thanks for sharing this worth able article here. Keep up this good work.

Web designing course in chennai | Web designing course | Web designing training in chennai

Jhon anderson said...

The content provided here is vital in increasing one's knowledge regarding hadoop, the way you have presented here is simply awesome. Thanks for sharing this. The uniqueness I see in your content made me to comment on this. Keep sharing article like this. Thanks :)

Hadoop Training Chennai | Big Data Training | Big data training in Chennai

Roshini RS said...

I feel satisfied to read your blog, you have been delivering a useful & unique information to our vision even you have explained the concept as deep clean without having any uncertainty, keep blogging.
Regards,
SAP training in chennai|SAP Training|SAP Institutes in Chennai|sap training in Chennai

Akula Rahul said...

MPCDF Technician Assistant Grade 3 Recruitment 2016

Thanks for providing valuable information in this article by author............

Savitha said...

Really awesome blog. Your blog is really useful for me.
Thanks for sharing this informative blog. Keep update your blog.
Oracle Training In Chennai

Diya Patel said...

Best SAS Training Institute In Chennai It’s too informative blog and I am getting conglomerations of info’s about Oracle interview questions and answer .Thanks for sharing, I would like to see your updates regularly so keep blogging.

Geetha said...

very informative blog. Helps to gain knowledge about new concepts and techniques. Thanks for posting information in this blog
Hadoop Training in Chennai

kanchana said...

Nice..Its informative...You have clearly explained about the concept..Its very useful for me to understand..Keep on sharing..
SAS training in chennai

Priya said...

Thanks for sharing this informative content on networking. The people who have suffficient knowledge about the networking can start preparing for CCNA. The basic knowledge about the routing algorithm, subnetting and switching adds advantage of learning CCNA.
ccna course in Chennai | ccna training in Chennai

Nikshitha S said...

Excellent post!!!. The strategy you have posted on this technology helped me to get into the next level and had lot of information in it.
salesforce training in chennai | salesforce training institute in chennai

Jhon anderson said...

It is good article. Our Hadoop Training in Chennai is more effective and real time environment. It is used to get wonderful job opportunities and also certified training. It’s concentrates on basic level to advance level training.
Thanks,
Hadoop course in Chennai | Hadoop Training institutes in Chennai

Andrew Son said...

Clear explanation.Thanks for sharing this informative post to my vision.Hadoop is the most popular language.Initially hadoop is developed for large amount of data sets in OLAP environment.
Regards,
Hadoop Training Chennai | Bigdata course in Chennai | Bigdata Training Chennai

Nikshitha S said...

Well Said, you have furnished the right information that will be useful to anyone at all time. Thanks for sharing your Ideas.
Node JS training in chennai | Node JS training institute in chennai

Priya said...

Excellent post!!!. The strategy you have posted on this technology helped me to get into the next level and had lot of information in it.
cloud computing training in chennai | cloud computing courses in chennai

geethu said...

Excellent post!!!. The strategy you have posted on this technology helped me to get into the next level and had lot of information in it.
Hadoop Training Chennai | PHP Training in Chennai

Arjun Rishi said...

Wonderful article. Thanks for sharing such a useful post.

seo training center in chennai

Sri Nithya said...

Excellent post.It is useful to update myself with new trends.
Java Training in chennai | Java course in chennai

Priya said...

Thanks for sharing this informative content that guided me to know the details about the training offered in different technology.
digital marketing course in chennai | digital marketing training in Chennai

Andrew Son said...

Hadoop is especially used for Big Data maintenance. It uses Hadoop distributed file system . Its operating system is in cross platform. Its framework mostly written in java programming language. The other languages which are used by hadoop framework are c, c++ (c with classes) and sometimes in shell scripting.Thank you..!!
Regards,
hadoop training in adyar | Hadoop Training in Chennai

Mathew Stephen said...

The act of utilizing a system of remote servers facilitated on the Internet to store, oversee, and handle information, as opposed to a neighbourhood server or a PC and thanks for taking time to share this webpage.It is really good and useful.
Cloud computing Training centers in Chennai | Cloud computing Training institutes in Chennai | Cloud computing Training in Chennai

Andrew Son said...

Excellent post!!PHP is abbreviated as Hypertext Preprocessor. It is server side scripting language used for web development.PHP was actually created by Rasmus Lerdorf.PHP code is processed by php interpreter as modules or Common Gateway Interface (CGI). It is also executed by Command Line Interface (CLI).Thank you..!!
Regards,
PHP Course in Chennai | PHP Training in Chennai

Rajapriya R said...

nice and really helpful article to everyone... thanks for sharing

selenium training in chennai | selenium training institute in chennai | Android training in chennai | android training institute in chennai

Nikshitha S said...

Updating with the latest technology and implementing it is the only way to survive in our niche. Thanks for making me this article. You have done a great job by sharing this content in here. Keep writing article like this.
SAS Training in Chennai | SAS Course in Chennai

Saradha Devi said...

keep updating interesting post

Best Selenium Training in Chennai | Android Training in Chennai | Java Training in chennai | Webdesigning Training in Chennai

Geetha Devi said...

Good one.Thank you for sharing
Best Selenium Training in Chennai |Selenium Training in Chennai |
Android Training in ChennaiBest Manual Testing Training in chennai

Nandhini said...

Well Said, you have furnished the right information that will be useful to anyone at all time. Thanks for sharing your Ideas.
Web Designing Course in Chennai | web designing training in chennai

John Alert said...

I have read your blog its very attractive and impressive. I like it your blog.

Java Training in Chennai Core Java Training in Chennai Core Java Training in Chennai

Java Online Training Java Online Training Core Java 8 Training in Chennai Java 8 Training in Chennai JavaEE Training in Chennai Java EE Training in Chennai

John Alert said...

Java Training Institutes Java Training Institutes Java Training in Chennai | Java Training in Chennai | Dot Net Training in Chennai JavaScript Training in CHennai JavaScript Training in CHennai | | Single Page Application Development

Rajapriya R said...

informative blog

selenium training in chennai | selenium training institute in chennai | Android training in chennai | android training institute in chennai

Geetha Devi said...

Thank you for sharing
Best Selenium Training in Chennai |Selenium Training in Chennai |
Android Training in ChennaiBest Manual Testing Training in chennai

Priya R said...

Updating with the latest technology and implementing it is the only way to survive in our niche. Thanks for making me this article. You have done a great job by sharing this content in here. Keep writing article like this.
SAS Training in Chennai | SAS Course in Chennai

John Alert said...

HTML5 Training in Chennai HTML5 Training in Chennai JQuery Training in Chennai JQuery Training in Chennai JavaScript Training in Chennai JavaScript Training in Chennai Full Stack Developer Training in Chennai Full Stack Developer Training in Chennai


AngularJS Training in Chennai AngularJS Training in Chennai Node.js Training in CHennai Angular 2 Training in Chennai Angular 2 Training in Chennai Node.js Training in CHennai Node.js Training in chennai MEAN Developer Training in Chennai

Priya R said...

The strategy you have posted on this technology helped me to get into the next level and had lot of information in it. The python programming language is very popular and most widely used.
Python Training in Chennai | Python Course in Chennai

Jones Sathya said...

Professional Expert level Android Training in chennai, Android App Development
Android Training | Android App Development | Training in chennai

Rajapriya R said...

informative blog..... keep updating

java training in chennai | java training institute in chennai | java j2ee training in chennai | java j2ee training institute in chennai

Geetha Devi said...

Very informative ..i suggest this blog to my friends..Thank you for sharing
Best Android training in chennai |

Android training in chennai |
Best Android Training institute in chennai

geethu said...

Nice interesting information on the latest arrived technology which helped me to get update according to the recent trends.
Salesforce Training in Chennai | Salesforce Course in Chennai

حسام داود said...

شركة تسليك مجاري بالرياض
شركة تسليك مجارى بالرياض
level تسليك المجاري بالرياض
افضل شركة تنظيف بالرياض
تنظيف شقق بالرياض
شركة تنظيف منازل بالرياض
شركة غسيل خزنات بالرياض
افضل شركة مكافحة حشرات بالرياض
رش مبيدات بالرياض
شركة تخزين عفش بالرياض
شركة تنظيف مجالس بالرياض
تنظيف فلل بالرياض
ابى شركة تنظيف بالرياض

Nandhini said...

Quite a useful post, I learned some new points here. Thanks admin please keep posting updates regularly to enlighten our knowledge.
PHP Training in Chennai | PHP Course in Chennai

Priya R said...

Updating with the latest technology and implementing it is the only way to survive in our niche. Thanks for making me this article. You have done a great job by sharing this content in here. Keep writing article like this.
Angularjs training in chennai | Angularjs course in Chennai

Priya R said...

Updating with the latest technology and implementing it is the only way to survive in our niche. Thanks for making me this article. You have done a great job by sharing this content in here. Keep writing article like this.
SAS Training in Chennai | SAS Training Institute in Chennai

Priya R said...

The strategy you have posted on this technology helped me to get into the next level and had lot of information in it.
Dot net training in Chennai | dot net course in Chennai

Nandhini said...

Thanks for sharing this informative content which provided me the required information about the latest technology.
Salesforce training in Chennai | Salesforce course in Chennai

Saradha Devi said...

great post thanks for sharing

Best Selenium Training Center in chennai | Best Automation Testing Training in Chennai

Priya R said...

Updating with the latest technology and implementing it is the only way to survive in our niche. Thanks for making me this article.
Node JS training in chennai | Node JS training institute in chennai

Priya R said...

Updating with the latest technology and implementing it is the only way to survive in our niche. Thanks for making me this article.
Node JS training in chennai | Node JS training institute in chennai

Priya R said...

Thanks for sharing information to our knowledge, it helps me plenty keep sharing…
Java Training in Chennai | JAVA Course in Chennai

rupiya dani said...

very nice post. Thanks for sharing. Web Designing Training Institute in Chennai | Web Designing Training Institute in Velachery.

siva siva said...

Thanks for your great information!
Campus Events|Upcoming College Events, Festivals, Workshops, Symposiums, Conference in india|College Festivals

Shivani Yuvanjalin said...

The best thing is that your blog really informative thanks for your great information! I have got some important suggestions from it.
Campus Events in India | College Paper Presentaions | College Festivals in India |College Workshops in India |College Symposiums in India |College Conference Registration Websites | Upcoming Events List in India

Brave Technologies said...

Great information. I have got some important suggestions from it. I'm working inERP Solutions in Chennai. | ERP Implementations in Chennai.

Evelin Harriet said...

I have read your blog its very Interesting and informative. Call for low cost ERP software. ERP Providers in Chennai

Siva Seo said...

The best thing is that your blog really informative thanks for your great information!
erp software solutions in chennai | erp providers in chennai | erp software solutions in chennai | erp implementations in chennai

Shivani Yuvanjalin said...

Nice blog. Thank you for sharing. The information you shared is very effective for learners I have got some important suggestions from it. erp providers in chennai.

deepti said...

Thanks for sharing your valuable information and keep updating such a wonderful article..
Java Training Institute in Chennai | Java Training in Chennai | Online Training Institute in Chennai

sivanesan said...

Nice blog. Thank you for sharing. The information you shared is very effective for learners I have got some important suggestions from it. erp software in chennai.

deepti said...

Your Blog is nice and informative..Thanks for sharing.

Dot Net Training Institute in Chennai | Best Dot Net Training in Chennai | No.1 Dot Net Training Institute in Chennai | Online Training in Chennai

muthu said...

Very informative content to sharing.. Software Testing Training Institute in Chennai | Software Testing Training Institute in Velachery.

Siva Seo said...

Thank you for this valuable information. I have got some important suggestions from it. web design in chennai

Fuzzy International said...

Thank you for your nice post. It is really useful. cashew nuts supplier in india | cashew nuts supplier in dubai

praveen said...

Good post. keep updating.. Web Designing Training Institute in Chennai | Web Designing Training Institute in Velachery.

srihariparu said...

Nice Blog..
Embedded Training Institute in Chennai | Embedded System Training in Chennai | Selenium Training in Chennai | Best Selenium Training in Chennai

Smith said...

An important building block of SEO is to develop your website which can be easily understandable for both Online Visitors (most important) and search engine robots. In the current digital age, seo is important for your online success means to generate leads.

SEO Services in IndiaSEO Company in India SEO Company in India SEO Services in India

SEO Company in India SEO Services in India

victoriya said...

Thank you for your nice post. It is really useful content..Android Training Institute in Chennai | Android Training Institute in Velachery.

kalai hai said...

Very nice post. Thank you for sharing such a wonderful blog...Linux Training Institute in Chennai | Linux Training Institute in Velachery.

deepti said...

Good and wonderful post...Selenium Training Institute in Chennai | Selenium Training Institute in Velachery

Krishna Veni said...

Good and interesting post... Thanks for sharing your views and ideas.... keep rocks..
Android Training in chennai | IOS Course in chennai

Divya madhuri said...

Nice blog with having good information. It’s very useful for everyone. Thanks and keep posting this type of blog
CCNA jobs in Hyderabad | CCNA Openings in Hyderabad .

lotus said...

Interesting and impressive article, it is very informative and thanks for sharing your valuable information and time...
Final Year Project Center in Chennai | Best Project Center in Chennai | No.1 Final Year Project Center in Chennai | Project Center in Velachery

fawaz shaik said...

Thanks for sharing such a wonderful post..
IOS Training Institute in Chennai | No.1 IOS Training Center in Chennai | Online Training in Velachery

rupiya rupi said...

Nice blog.You shared very useful post. Thanks for sharing.
Dot Net Training in Chennai | No.1 Dot Net Training Institute in Chennai | Best Dot Net Training Center in Chennai

sharma said...

Good and interesting article, it is very useful to me.. thanks for sharing your information and views.. keep updating and rocks..Web Designing Training Institute in Chennai | Web Designing Training Institute in Velachery.

revathi said...

This blog is really useful to create a signup form for me..thank you for sharing..
Best Linux Training Institute in Chennai | No.1 Linux Training Center in Chennai | Red Hat Linux Training Center in Chennai

ALINAAMEL said...

Keep working ,impressive job!
WordPress Lüdenscheid

varma said...

Excellent blog with great information, Thanks for sharing such a nice blog..Best Dot Net Training in Chennai | Best Java Training in Chennai | Best Web Design Training in Chennai

sreelakshmi hospitals said...

Very good post, it's very useful to all blog readers and Keep sharing.
Best Kidney Doctor in Bangalore
Best Urologist in Bangalore
Pediatric nephrologist in Bangalore

Fuzzy International said...

The best thing is that your blog really informative thanks for your great information!
cashew nuts supplier and exporter in dubai
onion supplier and exporter in dubai
A4 paper copier supplier and exporter in dubai
potato supplier and exporter in dubai
spices&grains supplier and exporter in dubai

Bashir Nisha said...

Awesome Blog with strong content. Kindly keep updating such a nice blog. MCSE Training Institute in Chennai | MCSA Training Institute in Chennai | Hardware & Networking Training in Chennai

annika romy said...
This comment has been removed by the author.
annika romy said...

Your website content nice nice and interesting to observe.
office 2013 professional plus key deutsch

Proplus Academy said...

Hi Good day....

Excellent post and very useful for everyone...keep updating
php training in coimbatore

seo training in coimbatore

web design training coimbatore

digital marketing training in coimbatore

subash said...
This comment has been removed by the author.
poornima said...

Excellent post and very useful for everyone...keep updating
Cloud Computing Project Center in Chennai | Cloud Computing Projects in Velachery

ALINAAMEL said...

Your website content nice nice and interesting to observe.
suchmaschinenoptimierung lüdenscheid

ALINAAMEL said...

Your website content nice nice and interesting to observe.
suchmaschinenoptimierung lüdenscheid

ancy said...

Thanks for posting this useful content, Good to know about new things here..keep on updating..Mobile Computing Projects Center in Chennai | Mobile Computing Projects Center in Velachery.

annika romy said...

Your website content nice nice and interesting to observe.
ssd festplatte samsung

annika romy said...

Your website content nice nice and interesting to observe.
ssd festplatte samsung

ASO Services said...

There are so many useful information in your post, I like it all the time. And I want to share this boost app ranking with you, you can take a look. This is very useful.

ALINAAMEL said...

Thanks For Your valuable posting, it was very informative
Internet Marketing Dienstleistungen

ALINAAMEL said...

Thanks For Your valuable posting, it was very informative
Internet Marketing Dienstleistungen