From owner-freebsd-questions Mon Jun 24 8:46:34 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mailhost.hirshfields.com (mailhost.hirshfields.com [63.226.159.37]) by hub.freebsd.org (Postfix) with ESMTP id 69EBA37B410 for ; Mon, 24 Jun 2002 08:46:17 -0700 (PDT) Received: from ultra.hirshfields.com (ultra.hirshfields.com [192.168.195.101]) by mailhost.hirshfields.com (8.11.4/8.11.4) with SMTP id g5OFk1e11338 for ; Mon, 24 Jun 2002 10:46:01 -0500 (CDT) Received: (qmail 3872 invoked from network); 24 Jun 2002 15:45:55 -0000 Received: from spicer.hirshfields.com (HELO hirshfields.com) (192.168.195.244) by ultra.hirshfields.com with SMTP; 24 Jun 2002 15:45:55 -0000 Message-ID: <3D173EB8.2040503@hirshfields.com> Date: Mon, 24 Jun 2002 10:46:00 -0500 From: C Peter Biessener User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.0rc2) Gecko/20020512 Netscape/7.0b1 X-Accept-Language: en-us, en MIME-Version: 1.0 To: FreeBSD Questions Subject: Bourne shell question Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG I have a program which may be run interactively or via cron. I want to use one shell wrapper for both instances. <--- fragment ---> if [ $interactive -eq $TRUE ]; then # myprog $interactive_args 2>&1 | tee -a $err_file myprog $interactive_args else myprog $cron_args >>$err_file 2>&1 fi if [ $? -ne 0 ]; then # do error processing . . . fi <--- fragment ---> I want my interactive users to see any errors (so they know if it failed), but ideally I would also like to capture the errors to an error file as well. However, if I use 'tee', then $? gets tee's exit value and not the exit value from myprog. Is there any way to be able to do what I want? Thanks, Peter Biessener To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message