running scripts within the current c-shell

Mike Coleman mkc+dated+1017096191.cecbe7 at mathdogs.com
Sat Feb 23 22:39:01 CST 2002


Bob Batson <rcb at kc.rr.com> writes:
> How's bash better than tcsh?

- csh is not suitable for scripting (see Gerald's link).  tcsh may have
  addressed some of these concerns, but I believe many of them still apply.

  Why does this apply if you're only going to use tcsh for interactive use?
  Because as you become more knowledgeable, you'll want more complex features
  in your rc files (e.g., .cshrc), and then (oops) you'll be scripting csh.

- With bash, you only have to know one language for both interactive and
  scripting use.  If your brain cells are limited like mine, this is a big
  win.  Bash's language is also a superset of Bourne shell, which is very
  useful since you should know 'sh' if you plan to write truly portable
  scripts.

- As far as I know, bash's features are virtually a superset of tcsh's.  (The
  only exception to this I can think of is tcsh's unlimit command, which is
  rarely used, but a bit easier to type than the equivalent bash ulimit.)

  I believe bash has a number of features that tcsh lacks.  Two nice ones that
  come to mind are command completion and help.  If you hit tab twice as
  you're typing in a command, bash will show you all the commands with the
  prefix you've typed in so far, which is very handy when you're trying to
  remember a command or type in a lengthy command name or just see what's in
  your path.  If you type in, say, 'help for', you'll get

     for: for NAME [in WORDS ... ;] do COMMANDS; done
         The `for' loop executes a sequence of commands for each member in a
         list of items.  If `in WORDS ...;' is not present, then `in "$@"' is
         assumed.  For each element in WORDS, NAME is set to that element, and
         the COMMANDS are executed.

  This makes a very handy cheat sheet as you're learning the language.

- bash looks to be better supported.  It's GNU, and the default and
  overwhelmingly most popular shell under GNU/Linux, and as such, it'll be
  well-supported for the forseeable future.

  The main think tcsh has going for it is that it's similar to csh, which a
  lot of people know.  I don't think people return to tcsh after they've
  given bash a good try.

Mike




More information about the Kclug mailing list