Installation - complaint about ^M on a line of shell script

bryan_e_boone - 07.11.2006, 21:37 Uhr
Titel: complaint about ^M on a line of shell script
I installed RC4 for a buddy of mine and I'm trying to do the du-fixes.sh script from h2. as root, I keep getting complaints about the ^M at the end of a line the script. The script works fine for me (AMD64) is there a setting I missed when I installed on his box?
h2 - 07.11.2006, 22:46 Uhr
Titel: RE: complaint about ^M on a line of shell script
that's not enough information to give a meaningful answer.

What is the exact nature of the error?

Line number, error, etc? However, if you run the script, and it runs without errors on one box, then you get an error with it like this, it's something else, but what I can't tell you.
slh - 07.11.2006, 23:48 Uhr
Titel: RE: complaint about ^M on a line of shell script
Don't use windows/ DOS systems for handling text files (or scripts), those a typical DOS line endings (carriage retun + line feed, instead of \n new line) and not compatible with UN*X.
bryan_e_boone - 08.11.2006, 01:05 Uhr
It looks like it happens after the#!bash line.
h2, it doesn't have problems on my amd64 distro, that's why I think it's my problem. I mailed it as an attachment thru thunderbird to my buddy. I wonder if t-bird goofed it up (probably).
slh, I'm not using DOS/Windows to edit the file but I guess it could have gotten transposed via the Exchange email when I mail it as an attachment.
I'll download it from the site (what was the link again, h2)
I was making sure I didn't goof up an installation like some encoding option I missed.
Thanks for the info guys.
BTW I can get the exact error message if you still want it. (in the morning)
Kano - 08.11.2006, 01:22 Uhr
Just use:

dos2unix script
h2 - 08.11.2006, 01:39 Uhr
bryan, if you want to get your friend the script, just go here, it's a shortcut:

cd /usr/local/bin
wget techpatterns.com/du-fixes
chmod +x du-fixes-h2.sh

or you could save it as one line:

cd /usr/local/bin;wget techpatterns.com/du-fixes;chmod +x du-fixes-h2.sh

then tell him just to paste that into console after logging in su <password> and hit enter.

that's all that is required. That avoids any potential file corruption issues altogether. I'm glad others recognized the error source, that sounds like a good guess to me as well. So just get it directly, or zip it up first, but it's really no harder typing in the above as root than saving something to /usr/local/bin as root etc.

First, of course, remember to rm / delete the old version
bryan_e_boone - 08.11.2006, 17:13 Uhr
Works great.... The dos2unix on the h2 script then he's done is first kernel update and dist-upgrade....
BTW... I'm not sure what put the ^M on the script lines... I'll bet it was Exchange.
Thanks for the info guys.

-Bryan (askani)
Swynndla - 09.11.2006, 02:07 Uhr
Emailing as an attachment should have been alright ... no ^M's would have been inserted. But if you friend opened the file in windows, then the windows app (depending on what he used) would have stuck in the ^M's ... and if he copy and pasted or saved, then he'd get the ^M's. Saving the attachment as is should be fine though.
bryan_e_boone - 09.11.2006, 02:29 Uhr
He may have saved the attachments in windows then used samba to snag them to linux. I have to convince him to drop the crutch and just use kanotix Winken
He's getting close.
Alle Zeiten sind GMT + 1 Stunde
PNphpBB2 © 2003-2007