Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'A script to manage system-wide services' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A script to manage system-wide services
Authored by: Hanji on Sep 20, '03 06:17:07PM
If you just download the file from the link, it appears that it has Mac line endings (\r), which will screw with bash. You need to replace them with \n somehow, such as by
perl -pi -e 's/\r/\n/;' nss
or with an editor like jEdit or (I believe) BBEdit.

[ Reply to This | # ]
A script to manage system-wide services
Authored by: Nostromo1965 on Sep 20, '03 08:09:19PM

I selected all of the text, did a Copy, then in terminal I did a 'pico -w' and pasted it in, and it worked fine.



[ Reply to This | # ]
A script to manage system-wide services
Authored by: sdt on Sep 21, '03 01:56:11PM

Same here. Saving it as a text file using TextEdit and then opening the file using pico or vi seems to cause the problem. A direct paste into pico or vi works fine.



[ Reply to This | # ]
A script to manage system-wide services
Authored by: wgscott on Sep 21, '03 11:21:46AM

You have to use backslash to escape the r and the n or else

you will only be replacing the letter r withthe letter n


perl -pi -e 's/\r/\n/g' foo.sh


I make an alias called

mac2unix

eg:

alias mac2unix "perl -pi -e 's/\r/\n/g'"

for tcsh

or

alias mac2unix="perl -pi -e 's/\r/\n/g'"

for zsh, bash, etc



[ Reply to This | # ]