nested ifs' in csh dont work?
Christopher North-Keys
harp at pkg.mcc.com
Wed Jun 6 21:27:37 AEST 1990
They do indeed work, if the "if" in each instance in immediately followed
by a space, as already noted. The only distinct oddness I've noted in Csh
programs is that aliases don't work placed in the format:
if (cond) alias
where instead the following *must* be used:
if (cond) then
alias
...
This type of thing also occurs in local variable setting. There must be
spaces on *both* sides of the "=", or neither. In contrast "=" is *not*
used in setenv commands. It's worth noting that all local variables are
vectors (lists), and can easily be used as local stacks.
Nesting of if/then/else/endif, switch/case/breaksw/default/endsw,
while/break/end, etc., all works as expected. The last person I found
having trouble was trying to use "break"/"end" in "switch", instead of the
required "breaksw"/"endsw". He enclosed the entire switch in a "while 1 /
end" loop to get the misbegotten "break"/"end"s to do what he wanted.
This is called not reading the manual, folks.
I find the C shell flow constructs much more obvious than I do the Bourne.
The keyword "breaksw" is rather more intuitive than ";;". But then, I'm a
C(++) programmer, and such were also the C shell authors :-).
Someone needs to write a nice, new (PD) shell from scratch, of course.
None of the existing shells are what I'd call either "consistent", or
"elegant" (personal opinion of: sh, ksh, csh, bash, tcsh). In particular,
none of them support the loading of additional object modules at runtime,
nor state-dumping or the like (like GNUemacs) to reduce startup time.
Their command sets all require bizarre parsing (contrast to languages like
Lisp and Forth), and all have peculiarities.
------------------------------------/\----------------------------------------
Seo: Harp[@Mcc.Com] / \/\ ^*^ Christopher North-Keys
Tha mi gu trang a'cluich. / \ \ Assoc. Systems Analyst, MCC
--------------------------------(disclaimer)----------------------------------
More information about the Comp.sys.sun
mailing list