Autor |
Nachricht |
|
Titel: complaint about ^M on a line of shell script
Verfasst am: 07.11.2006, 21:37 Uhr
|
|
Anmeldung: 05. Jan 2006
Beiträge: 118
|
|
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? |
_________________ What is, is
|
|
|
|
|
|
Titel: RE: complaint about ^M on a line of shell script
Verfasst am: 07.11.2006, 22:46 Uhr
|
|
Anmeldung: 12. Mar 2005
Beiträge: 1005
|
|
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. |
_________________ Read more on dist-upgrades using du-fixes-h2.sh script.
New: rdiff-backup script
|
|
|
|
|
|
Titel: RE: complaint about ^M on a line of shell script
Verfasst am: 07.11.2006, 23:48 Uhr
|
|
Anmeldung: 16. Aug 2004
Beiträge: 1905
|
|
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. |
|
|
|
|
|
|
Titel:
Verfasst am: 08.11.2006, 01:05 Uhr
|
|
Anmeldung: 05. Jan 2006
Beiträge: 118
|
|
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)
-Bryan |
_________________ What is, is
|
|
|
|
|
|
Titel:
Verfasst am: 08.11.2006, 01:22 Uhr
|
|
Anmeldung: 17. Dez 2003
Beiträge: 16790
|
|
Just use:
dos2unix script |
|
|
|
|
|
|
Titel:
Verfasst am: 08.11.2006, 01:39 Uhr
|
|
Anmeldung: 12. Mar 2005
Beiträge: 1005
|
|
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 |
_________________ Read more on dist-upgrades using du-fixes-h2.sh script.
New: rdiff-backup script
|
|
|
|
|
|
Titel:
Verfasst am: 08.11.2006, 17:13 Uhr
|
|
Anmeldung: 05. Jan 2006
Beiträge: 118
|
|
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) |
_________________ What is, is
|
|
|
|
|
|
Titel:
Verfasst am: 09.11.2006, 02:07 Uhr
|
|
Anmeldung: 05. Dez 2005
Beiträge: 414
Wohnort: Auckland, New Zealand
|
|
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. |
_________________ Linux is evolution, not intelligent design - Linus Torvalds
|
|
|
|
|
|
Titel:
Verfasst am: 09.11.2006, 02:29 Uhr
|
|
Anmeldung: 05. Jan 2006
Beiträge: 118
|
|
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
He's getting close. |
|
|
|
|
|
|