From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26311 invoked from network); 22 Jun 2001 06:02:17 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 22 Jun 2001 06:02:17 -0000 Received: (qmail 17740 invoked by alias); 22 Jun 2001 06:01:33 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 15037 Received: (qmail 17714 invoked from network); 22 Jun 2001 06:01:30 -0000 X-Envelope-Sender-Is: Andrej.Borsenkow@mow.siemens.ru (at relayer david.siemens.de) From: "Andrej Borsenkow" To: "Brian Harvell" , Subject: RE: status codes on Dec OSF Date: Fri, 22 Jun 2001 10:01:57 +0400 Message-ID: <000601c0fae0$d819c640$21c9ca95@mow.siemens.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Importance: Normal > > The following script produces different results when run on a dec > machine vs > a solaris machine. It seems the dec doesn't see the status code > of the command > if your setting the output to a varible. > > %cat foo > FOO=`jfkljfs` > echo $? > FOO=`pwd` > echo $? > > jfkljfs > echo $? > pwd > echo $? > > > >From the dec 4.0F machine > % /opt/bcs/packages/zsh-4.0.1/bin/zsh -x foo > +foo:1> FOO=+foo:1> jfkljfs > foo:1: command not found: jfkljfs > +foo:1> FOO= > +foo:2> echo 0 > 0 Sigh, this is a bug :-( If there is a command name, execution will continue as described in Command Search and Execution . If there is no command name, but the command contained a command substitution, the command will complete with the exit status of the last command substitution performed. Otherwise, the command will complete with a zero exit status. Actually, zsh has long standing POSIX incompatibility w.r.t. exit codes; I am not sure how diffecult it is to change it: If a command is not found, the exit status will be 127. If the command name is found, but it is not an executable utility, the exit status will be 126. Applications that invoke utilities without using the shell should use these exit status values to report similar errors. -andrej