Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Jul 2000 19:23:54 +0100
From:      "Carlos J. G. Duarte" <cgd@teleweb.pt>
To:        John Baldwin <jhb@pike.osd.bsdi.com>, freebsd-questions@FreeBSD.ORG
Subject:   Re: Is the C-shell (csh) a bad shell?
Message-ID:  <3975F23A.85267D8B@teleweb.pt>
References:  <200007182310.QAA55420@pike.osd.bsdi.com>

next in thread | previous in thread | raw e-mail | index | archive | help
John Baldwin wrote:
[...] 
> 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.  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.

functions for me aren't a great problem, as I don't use it, because
some olders sh's, or some systems stock /bin/sh doesn't support them
(they put the newer shells as /sbin/sh or /bin/sh, or even
have differents /bin/sh and /usr/bin/sh)

the redirections, quoting, and other syntax aspects, however, 
are a real problem.

for instance, sometime, on hacking scritps, we might wan't
to do: 

cat<<EOF|
http://www..../pub/somedocs/text1.ps
http://www..../pub/somedocs/text2.ps
EOF
while read x; do
	wget $x 
done

which is very useful, but impossible in csh.

as for quoting ,in sh '' quotes everything except ' itself,
"" quotes almost everything, except ` $ and \ with csh, 
you might be prepared to get some weird behavior. 

there is one thing that csh has, that I miss in sh: goto's!

I also use tcsh interactivelly, as I found it not too overloaded
(like zsh), but very fast for the features it supports (smart 
completition, alias, smart history [try '$ lESC-p'] and 
useful builtin keystrokable functions [try '$ *sh^X*])

But don't script in [t]csh, only in sh, unfortunally,
as tcsh is my interactive shell, I was forced to do
3 csh scripts -- this one ( http://cgd.teleweb.pt/login.txt )
is the worst/painful ( check also the cshrc.txt and tcshrc.txt
to get the full suite!)

-- 
carlos


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3975F23A.85267D8B>