From owner-freebsd-hackers Sat Aug 28 1: 5:53 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from fleming.cs.strath.ac.uk (fleming.cs.strath.ac.uk [130.159.196.126]) by hub.freebsd.org (Postfix) with ESMTP id 8AFE814DF9; Sat, 28 Aug 1999 01:05:07 -0700 (PDT) (envelope-from roger@cs.strath.ac.uk) Received: from cs.strath.ac.uk (scary.dmem.strath.ac.uk [130.159.202.5]) by fleming.cs.strath.ac.uk (8.8.8/8.8.8) with ESMTP id JAA14377 Sat, 28 Aug 1999 09:04:20 +0100 (BST) Message-ID: <37C79822.D28CD168@cs.strath.ac.uk> Date: Sat, 28 Aug 1999 09:04:50 +0100 From: Roger Hardiman Organization: Strathclyde University X-Mailer: Mozilla 4.51 [en] (X11; I; FreeBSD 3.2-STABLE i386) X-Accept-Language: en MIME-Version: 1.0 To: hackers@freebsd.org, luigi@freebsd.org, abial@freebsd.org Subject: Help with exit status in shell script Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hi, There is a bug in the PicoBSD build shell script in and I have no idea how to fix it. As a result, build errors are not caught. It is all to do with Exit Status of programs called from a shell script. Please help. The code fragment from /usr/src/release/picobsd/build/build is ./stage1 2>&1 | tee stage1.out if [ "X$?" != "X0" ] ; then echo "^G" echo "-> ERROR in \"${i}\" script. Aborting the build process." exit 10 fi Build calls Stage1. Stage1 will return with an error code in some cases and we want to trap this and halt the Build script. ./stage1 2>&1 | tee stage1.out if [ "X$?" != "X0" ] ; then Normally, $? will return the Exit Status of the last executed program. However, due to the pipe through Tee, the Exit Status I get is the exit status of Tee and not the exit status of the Stage1 script. I still want to output the stage1 script to screen and a log file. How can I do this and preserve the exit status for the Build script. Thanks Roger -- Roger Hardiman roger@freebsd.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message