On Friday, 23 בNovember 2007, Oleg Goldshmidt wrote: > "Amos Shapira" <[EMAIL PROTECTED]> writes: > > - properly-written shell scripts shouldn't depend on their > > environment
Hmmm... I hope you don't advocate massive overriding of environment variables in shell scripts: PATH, HOME, TERM and zillions of others are meant to be inheritted. That's what the environment is for. What shell scripts *should* depend is standard behaviour, both of the shell and many other standard utilities (ls, tar, pwd, etc). > But t?csh was *not* the default interactive shell on those systems. I The correctness of you assertion greatly depends on which "those" you mean. Sunos (which was the dominant Unix throughout the 80's and the beginning of the 90's) had /bin/csh as default. BTW, this explains how some parts in the academic world got the weird idea of teaching scripting in csh. > For reasons of portability that you mentioned yourself, the default > SHELL used by many programs (e.g., make) is /bin/sh. That is what > changed on Kfir's system, changed in a way that a user cannot > override Completely agree. > ...and it turned out that as a result a utility so basic > as echo did not implement any options (-n and -e are just about the > only options echo has). Berkeley 'echo': Uses the -n option to suppress newlines. System-V 'echo' (base of POSIX standard): Uses escapes (\c to cancel newline, \t for tab, etc). Linux /bin/echo: Berkeley like with some extra options (including a -e to enable Sys-V escapes). Bash: ditto. Tcsh: configurable behaviour depending on $echo_style So it's risky to take echo for granted. What you thought as standard (bash behaviour) is actually an extension of the standard. > But there is a lesson here somewhere: a) don't use echo options in > portable #!/bin/sh scripts; Good advice. > b) consider #!/bin/bash even for portable code (restricting it to > systems with bash installed, of course). Hmmm... I disagree, but I'll leave it as a religious subject ;-) -- Oron Peled Voice/Fax: +972-4-8228492 [EMAIL PROTECTED] http://www.actcom.co.il/~oron ICQ UIN: 16527398 "Copyright protects Software. Patents protect Software Monopolies." http://swpat.ffii.org/ ================================================================To unsubscribe, send mail to [EMAIL PROTECTED] with the word "unsubscribe" in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]