🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.shell
Article #1198

Re: Help needed with conditional statement for alias in csh

#1198
From: Per Hedeland
Date: Fri, 21 Sep 1990 09:36
32 lines
2128 bytes
In article <1990Sep20.090627.20515@Neon.Stanford.EDU>,
dkeisen@Gang-of-Four.Stanford.EDU (Dave Eisen) writes:
|> Speak for your own C-shell. 

I spoke for *the* C-shell, as found in the BSD distribution (I wouldn't
dream of claiming any ownership:-). If someone distributes a shell where the
meaning of && and || is reversed, it certainly isn't the C-shell, just as a
compiler for a language that reverses the meaning of those two isn't a C
compiler.

|> In SCO Xenix, the C-shell thinks it really is C:
|> 
|> 	test -s /usr/spool/mail/miller 
|> 
|> returns 0 (assuming the file is nonempty) so the C-shell doesn't 
|> evaluate the second half of the conditional expression.

I don't buy the "really is C" "justification" - I think that the proper
point of view is that in C, as in Bourne shell and C-shell, the expression
following && is evaluated if the preceding expression is *true* - the fact
that C (and the C-shell in 'if' etc) happens to define "true" as non-zero
and the shells and utilities define it as (return code) zero may be
confusing but is nonetheless irrelevant.

Of course, the csh man page doesn't talk about "true" in this context, but
rather "fails" and "succeeds" - surely not even SCO thinks that return code
zero from a Unix program is a failure indication?

--Per Hedeland
per@erix.ericsson.se  or
per%erix.ericsson.se@uunet.uu.net  or
...uunet!erix.ericsson.se!per
Technical Details
Message-ID: <1990Sep21.093645.16163@eua.ericsson.se>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!snorkelwacker!bloom-beacon!eru!hagbard!sunic!ericom!eua.ericsson.se!erix.ericsson.se!per
References: <6932.26ed237f@uwovax.uwo.ca> <26553@mimsy.umd.edu> <1990Sep18.223605.29379@eua.ericsson.se> <1990Sep20.090627.20515@Neon.Stanford.EDU>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!snorkelwacker!bloom-beacon!eru!hagbard!sunic!ericom!eua.ericsson.se!erix.ericsson.se!per
From: per@erix.ericsson.se (Per Hedeland)
Newsgroups: comp.unix.shell
Subject: Re: Help needed with conditional statement for alias in csh
Message-ID: <1990Sep21.093645.16163@eua.ericsson.se>
Date: 21 Sep 90 09:36:45 GMT
References: <6932.26ed237f@uwovax.uwo.ca> <26553@mimsy.umd.edu> <1990Sep18.223605.29379@eua.ericsson.se> <1990Sep20.090627.20515@Neon.Stanford.EDU>
Sender: news@eua.ericsson.se
Reply-To: per@erix.ericsson.se (Per Hedeland)
Organization: Ellemtel Telecom Systems Labs, Stockholm, Sweden
Lines: 32