From owner-freebsd-questions Tue Jul 18 23: 9:56 2000 Delivered-To: freebsd-questions@freebsd.org Received: from merlin.prod.itd.earthlink.net (merlin.prod.itd.earthlink.net [207.217.120.156]) by hub.freebsd.org (Postfix) with ESMTP id 2681137BCFC for ; Tue, 18 Jul 2000 23:09:52 -0700 (PDT) (envelope-from cjc@pool1056.cvx20-bradley.dialup.earthlink.net) Received: from pool1056.cvx20-bradley.dialup.earthlink.net (pool1056.cvx20-bradley.dialup.earthlink.net [209.179.254.36]) by merlin.prod.itd.earthlink.net (8.9.3-EL_1_3/8.9.3) with ESMTP id XAA24443; Tue, 18 Jul 2000 23:09:48 -0700 (PDT) Received: (from cjc@localhost) by pool0342.cvx20-bradley.dialup.earthlink.net (8.9.3/8.9.3) id XAA00913; Tue, 18 Jul 2000 23:08:03 -0700 (PDT) Date: Tue, 18 Jul 2000 23:07:33 -0700 From: "Crist J. Clark" To: John Baldwin Cc: Alfred Perlstein , FreeBSD@pike.osd.bsdi.com, questions , "David J. Kanter" Subject: Re: Is the C-shell (csh) a bad shell? Message-ID: <20000718230732.C677@pool1162.cvx20-bradley.dialup.e> Reply-To: cjclark@alum.mit.edu References: <20000718160249.I13979@fw.wintelcom.net> <200007182310.QAA55420@pike.osd.bsdi.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0.1i In-Reply-To: <200007182310.QAA55420@pike.osd.bsdi.com>; from jhb@pike.osd.bsdi.com on Tue, Jul 18, 2000 at 04:10:47PM -0700 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Tue, Jul 18, 2000 at 04:10:47PM -0700, John Baldwin wrote: > > * David J. Kanter [000718 15:57] wrote: > > > I'd like to learn a shell fairly well and chose csh because it's in the base > > > FreeBSD system (a little graybeard character) and I found good documentation > > > on it written by William Joy. But I've read some things that it's a "bad" > > > shell. > > > > > > Is it? > > > > > > It seems that, at some level, all shells are essentially equal. But when > > > shells start to divide is csh left in the dust? What about the shells I've > > > read rave things about: Korn and Bash. > > > > > > I've got C++ experience, so maybe that's why I chose csh too. > > > > *** CSH PROGRAMMING CONSIDERED HARMFUL *** > > > > Resolved: The csh is a tool utterly inadequate for programming, > > and its use for such purposes should be strictly banned! > > > > http://arch.freeciv.org/aclug-l-199811/msg00018.html > > > > -Alfred > > I have found this and similar anti-csh arguments to be largely a matter > of opinion and personal style rather than having any substance. The > same can be said for most programming language wars. There are two > rather large shortfalls in csh's language, however. It does not support > functions (except perhaps by abusing aliases), and it does not allow the > same amount of flexibility in I/O redirection. However, I rarely find > that I use much of the added flexibility of I/O redirection in sh. Eep!!! I/O redirection is why I reason (1) why I always do any serious (anything not written at the command line) scripting in sh and find myself dropping to bash at the command line (I usually use tcsh as my interactive shell). Besides the obvious shortcoming of not being able to direct stdout and stderr seperately, try to do this, $ while read WORD REST; do > blah... > blah... > done < file_in > file_out And reason (2) is that if I do end up doing a foreach in [t]csh, the commands inside of it are lost in the history where bash would keep everything I typed above. > For > scripts where I need that or where I need functions, I tend to use sh. > For other scripts I tend to use csh. Perhaps it's my Pascal background > showing through, but I prefer if (foo) then endif to if [ foo ]; then fi. Oh, here is reason 3, try putting a pipe, conditional, or anything but a basic command in an, if { } then .. endif > Basically, I freely use both, and use tcsh as my interactive shell. There > is certainly no harm in learning csh, but I would also learn sh as well. But in the end, we agree. I still find tcsh is great for little command line jobs like, % foreach file ( pattern* ) > mv $file $file:r_old.$file:e > endif -- Crist J. Clark cjclark@alum.mit.edu To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message