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


Click here to return to the 'We do it just to taunt you...' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
We do it just to taunt you...
Authored by: noworryz on Mar 10, '03 06:48:44PM

That and because:

  1. The standard OS X shell for users is /bin/tcsh.
  2. /bin/sh has no "if" statement, so you have to replace if ($status != 0) with [$? -ne 0] && -- not a very obvious construct for non-programmers.
  3. The csh man page is less geeky than the sh man page.


[ Reply to This | # ]
We do it just to taunt you...
Authored by: thrig on Mar 10, '03 08:28:18PM
  1. A leading #!/bin/sh on a script in no way involves csh or tcsh. That Apple makes a C-ish shell the default shell is unfortunate.
  2. /bin/sh on OS X does have an if statement. And I strongly doubt csh is any better for "non-programmers" than a Bourne-based shell.
  3. C-ish shells complicate matters as admins have to document and maintain two different syntaxes, and figure out which one the user is using when doing support.
  4. Furthermore, csh and tcsh offer no benefits over the rich family of Bourne-based shells (ksh, bash, zsh), and plenty of drawbacks, which are well documented in "CSH Programming Considered Harmful."

    http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/



[ Reply to This | # ]
Migration guide?
Authored by: hayne on Mar 10, '03 09:40:22PM

As has already been remarked above, the main reason why people write scripts in 'csh' is that they are used to 'csh' from using it interactively (in Terminal). Someone should write a migration guide for people (like me) whose default shell has been 'csh' (or 'tcsh') for many years and who therefore have a lot of inertia that works against changing shells. Such a guide would show the equivalents of such 'csh' things as aliases, foreach loops, etc, and point out the "gotchas" (e.g. my experience is that whitespace matters more in 'sh' than it does in 'csh' but I'm not sure where & how.)



[ Reply to This | # ]
We do it just to taunt you...
Authored by: mervTormel on Jul 09, '03 10:42:22AM

worry...

$ man sh
...
Reserved Words

Reserved words are words that have special meaning to the
shell and are recognized at the beginning of a line and
after a control operator. The following are reserved
words:

! elif fi while case
else for then { }
do done until if esac
...



[ Reply to This | # ]
We do it just to taunt you...
Authored by: almage on Mar 26, '04 09:59:03AM

Actually, in Panther, the default shell for a new user is bash. This is a change from Jaguar, where tcsh was the default shell for a new user.

My two-cents: I use tcsh as my login shell, and do ALL my shell scripting in Bourne shell (sh). I have little difficulty with the sh syntax, and have found the case structure of sh to be superior to that of csh.



[ Reply to This | # ]