Pick of the Week - Nov 10 [Show all picks]
Path Finder 5 - A feature-laden Finder replacement
Submit Hint Search The Forums LinksStatsPollsFAQHeadlinesRSS
12,000 hints and counting!


Click here to return to the '10.5: Fix the echo -n problem in 10.5' hint
The following comments are owned by whomever posted them. This site is not responsible for what they say.
10.5: Fix the echo -n problem in 10.5
Authored by: unixhead94 on Tue, Nov 20 2007 at 3:56PM PST

This is a feature, not a bug.

For all we know, there may very well be some old BSD cruft that depends on /bin/sh behavior that may break if you do this.

It's surprising that this fix even works since bash is supposed to switch to POSIX mode if it's invoked as /bin/sh.

http://www.gnu.org/software/bash/manual/bashref.html#SEC85



[ Reply to This | # ]
10.5: Fix the echo -n problem in 10.5
Authored by: jeremyp on Tue, Nov 20 2007 at 4:12PM PST
The bash man page I consulted said that invoking it as sh emulates sh start up behaviour (i.e. ignores .bash_profile and .bashrc) but it does not state anywhere that builtin commands will revert to sh behaviour.

In fact, I tried echo -n from bash and sh on my 10.4 system and my Linux system and in all cases, the -n was recognised as a switch. On both of those machines, /bin/sh and /bin/bash were identical (in fact, on the Linux box, /bin/sh was a symlink).

It looks to me like Apple have compiled bash with a patch to produce sh on 10.5. It may be that the patch only disables the echo -n switch, but it may be that it alters the behaviour of sh in other ways in order to be Unix compliant. For this reason, I'd say it is quite dangerous to replace /bin/sh with /bin/bash, random shell scripts might break as a result.

In fact, I'd agree with the opinion expressed earlier that the 10.5 behaviour amounts to a bug fix.

[ Reply to This | # ]