/bin/bash^M: bad interpreter: no such file or directory
SlackwareThis Forum is for the discussion of Slackware Linux.
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.
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.
/bin/bash^M: bad interpreter: no such file or directory
Hey people! I am trying to install Slackware in a..."different" way. First of all, I install only the base. Then, I boot into my new slackware system, go to a directory where I have packages and use a simple script in shell to install them. It is something like that:
/bin/bash^M: bad interpreter: no such file or directory
So I use vi to see the file and delete the damn it ^M after #!/bin/bash and surprise: there was no ^M. It is just as I typed: #/bin/bash [ENTER] [ENTER] echo Installing packages... [ENTER] ... so what could be happening? Why when I try to run the script does the command line think that there is a "^M" after every line? Is there anything I can do? Thanks!
In the future, you can easily convert between DOS and UNIX text file formats using fromdos and todos. They are called "dos2unix" and "unix2dos" on most other distributions.
sed s/{ctrl+v}{ctrl+m}// filename > filename.tmp && mv filename.tmp filename
Please note it is not safe to read a file into sed and write directly back to the same file, you will end up with an empty file!
If you use the -i option, sed will edit the original file "in-place", that is it will write the changes to the input file, so your command can be shortened:
If you use the -i option, sed will edit the original file "in-place", that is it will write the changes to the input file, so your command can be shortened:
And for future reference: don't create Unix/Linux scripts on a windows-box ;}
Cheers,
Tink
I had a similar thing happen only the other day with one of my scripts (though it wasn't a /r). I was actually writing it using vi (elvis) running in an xterm. Anyway, somehow I ended up with non-printable characters in there that were breaking one of my if/fi blocks and causing the script to throw a wobbly. If it hadn't been for the syntax highlighting, I'd have had a nightmare in finding out why it wasn't working. As it was I noticed that the 'fi' wasn't highlighted and that was the giveaway.
I know the way tty/xterm works is somewhat antiquated in how it deals with input, control/escape sequences etc. It's probably safest to use a native X11 editor that isn't going to be as susceptible to this sort of thing.
edit: ah damn. responding to a resurrected thread again. I really must check the dates more thoroughly.
And if you do edit them on Windows, use a better text editor, such as EditPad Lite, which automatically opens files, converts files, and allows you to write files, in whatever format.
edit: ah damn. responding to a resurrected thread again. I really must check the dates more thoroughly.
Oops! me too, GazL.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.