Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
|
09-19-2007, 05:15 AM
|
#16
|
LQ Newbie
Registered: May 2005
Posts: 13
Rep:
|
bad interpreter: No such file or directory
I also got above error; so I was looking going through this topic.
Just to add -- this error also comes when no perl is installed on your system.
While trying command "perl -i -pe's/\r$//;' <file name here>" I come to know about this  Thanks!!!
Sadashiv
|
|
|
02-25-2008, 11:09 PM
|
#17
|
LQ Newbie
Registered: Dec 2007
Posts: 4
Rep:
|
Quote:
Originally Posted by mahantesh_hongal
Dear wbrummet. Thanks a billion.
Your simple perl command (perl -i -pe's/\r$//;' <file name here>) clears up my issue 
Thanks,
Mahantesh Hongal
|
thanks, your cr/lf suggestion is still helping people!
c.
|
|
|
04-22-2008, 02:17 AM
|
#18
|
LQ Newbie
Registered: Apr 2008
Posts: 1
Rep:
|
Thanks XunXu and wbrummet!
Both these worked -
dos2unix <filename>
perl -i -pe's/\r$//;' <filename>
|
|
|
04-24-2008, 05:16 PM
|
#19
|
LQ Newbie
Registered: Apr 2008
Posts: 14
Rep:
|
Either using the perl command:
Code:
perl -i -pe's/\r$//;' <file name here>
or trying to ftp the script from a Windows-based machine to a Unix-based machine while NOT under binary mode will do the job
Thanks to both wbrummet and timmeke!
|
|
|
06-16-2008, 05:06 PM
|
#20
|
LQ Newbie
Registered: Nov 2006
Posts: 2
Rep:
|
Quote:
Originally Posted by tieuphongvan
Either using the perl command:
Code:
perl -i -pe's/\r$//;' <file name here>
or trying to ftp the script from a Windows-based machine to a Unix-based machine while NOT under binary mode will do the job
Thanks to both wbrummet and timmeke!
|
I had this issue which drove me nuts. I was familiar with dos2unix and the variations of line feeds...but still nothing fixed it and it still didn't execute.
As it turns out, the script I was trying to execute was on a external USB drive mounted with the 'noexec' option. doh! Move the script to local hard drive (mounted without 'noexec' obviously) and everything works...
Regards,
Peter
|
|
|
11-14-2008, 03:16 PM
|
#21
|
LQ Newbie
Registered: Nov 2008
Posts: 5
Rep:
|
I was facing the same problem and converting from dos to the uniz format did the trick
|
|
|
01-15-2009, 09:11 AM
|
#22
|
LQ Newbie
Registered: Jan 2009
Posts: 1
Rep:
|
Quote:
Originally Posted by wbrummet
I have run into this problem many times when editing scripts on a windows based system then FTP'ing them onto my servers. I simple Perl command always seems to clear up the problem. Try the following command on your text file then try and run it.
perl -i -pe's/\r$//;' <file name here>
|
Thanks. This script worked for me as well. What does it do?
|
|
|
03-19-2009, 09:47 AM
|
#23
|
LQ Newbie
Registered: Dec 2004
Location: Texas
Distribution: Fedora Core 6, CentOS 4.4, CentOS 5
Posts: 14
Rep:
|
Quote:
Originally Posted by timmeke
A lot of the commands (using tr, perl, ...) posted here all do pretty much the same as the "dos2unix" utility mentioned. Please use this utility, as it was specifically created for this CR\LF issue.
|
Yes, dos2unix may be preferred, but it's not always installed. I ran into this issue today with a server that did not have a dos2unix command but did have perl installed, so the perl one liner here saved me a bit of time.
We should encourage alternative solutions, not discourage them.
-Jeremy
|
|
|
03-19-2009, 11:10 AM
|
#24
|
Senior Member
Registered: Mar 2007
Location: Russia
Distribution: Slackware 12.2
Posts: 1,202
Rep:
|
Quote:
Originally Posted by Samurai Unix
Thanks. This script worked for me as well. What does it do?
|
It changes line endings from windows to unix format.
Quote:
Originally Posted by irwinr
We should encourage alternative solutions, not discourage them.
-Jeremy
|
The thread is dead. First message is from 2004.
|
|
|
03-19-2009, 11:22 AM
|
#25
|
Senior Member
Registered: Apr 2003
Location: Germany
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,639
Rep: 
|
Quote:
Originally Posted by ErV
...The thread is dead...
|
It's not, since you just posted  .
|
|
|
03-20-2009, 12:16 PM
|
#26
|
LQ Newbie
Registered: Apr 2008
Posts: 14
Rep:
|
Quote:
Originally Posted by JZL240I-U
It's not, since you just posted  .
|
It took 1 yr for a good solution, and there are still people looking for the same solution after 5 yrs....Long live thread, woot
|
|
|
04-01-2009, 05:01 PM
|
#27
|
Member
Registered: Oct 2005
Location: Bhopal, India
Distribution: RHEL 6
Posts: 422
Rep:
|
Thanks
This worked great.
Code:
perl -i -pe's/\r$//;' <file name here>
Thanks.
Manish
|
|
|
04-03-2009, 07:42 PM
|
#28
|
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,430
|
I'd be surprised if dos2unix is not part of the std install these days..
|
|
|
03-30-2010, 06:51 AM
|
#29
|
LQ Newbie
Registered: Mar 2010
Posts: 1
Rep:
|
I had the same problem as everybody who has been asking here.
I tried some of the suggested ideas but still no success
The way I have fixed it is by removing the top line
#!/bin/bash
once I removed that, is working very well
Hope this helps
Marco
|
|
|
11-11-2010, 11:50 AM
|
#30
|
LQ Newbie
Registered: Nov 2010
Posts: 1
Rep:
|
Quote:
Originally Posted by nx5000
Put this in .vimrc
" Add keymappings
map <F4> :set fileformat=unix<CR>
map <F5> :set fileformat=dos<CR>
Then use F4/F5 for changing fileformat
|
thanks, this gets to the heart of the problem, and provides a solution.
coming from the unix side, hadnt realized that linux vi defaulted (at least in my RHEL distro) to dos crlf behavior.
which is bad imo, since it breaks intrinsic functionality.
|
|
|
All times are GMT -5. The time now is 09:52 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|