From owner-freebsd-questions@FreeBSD.ORG Wed Feb 18 20:47:01 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EC5011065672 for ; Wed, 18 Feb 2009 20:47:01 +0000 (UTC) (envelope-from cswiger@mac.com) Received: from mail-out3.apple.com (mail-out3.apple.com [17.254.13.22]) by mx1.freebsd.org (Postfix) with ESMTP id D0D698FC19 for ; Wed, 18 Feb 2009 20:47:01 +0000 (UTC) (envelope-from cswiger@mac.com) Received: from relay10.apple.com (relay10.apple.com [17.128.113.47]) by mail-out3.apple.com (Postfix) with ESMTP id 910615325325; Wed, 18 Feb 2009 12:47:01 -0800 (PST) Received: from relay10.apple.com (unknown [127.0.0.1]) by relay10.apple.com (Symantec Brightmail Gateway) with ESMTP id 72FAB28059; Wed, 18 Feb 2009 12:47:01 -0800 (PST) X-AuditID: 1180712f-a996cbb0000012d3-75-499c73c5d511 Received: from cswiger1.apple.com (cswiger1.apple.com [17.227.140.124]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by relay10.apple.com (Apple SCV relay) with ESMTP id 5FDD428054; Wed, 18 Feb 2009 12:47:01 -0800 (PST) Message-Id: <5A806B91-857E-4084-9CB3-0F87E2C46786@mac.com> From: Chuck Swiger To: GESBBB In-Reply-To: <644168.76348.qm@web32101.mail.mud.yahoo.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v930.3) Date: Wed, 18 Feb 2009 12:47:01 -0800 References: <502804.7096.qm@web32108.mail.mud.yahoo.com> <499C2F76.30507@infracaninophile.co.uk> <644168.76348.qm@web32101.mail.mud.yahoo.com> X-Mailer: Apple Mail (2.930.3) X-Brightmail-Tracker: AAAAAA== Cc: FreeBSD Users Questions Subject: Re: Problem with BASH and [ ! -t 0 ] test. X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Feb 2009 20:47:02 -0000 On Feb 18, 2009, at 12:29 PM, GESBBB wrote: > I am a little confused. I believe the problem is with the "if [ ! -t > 0 ]" statement. I tried to redirect the error message; however, it > still appears in the email sent by CRON. I tried using this > statement instead: if ( ! tty -s &> /dev/null ) and "if ( ! tty -s ) > &> /dev/null"; however, they also produce an error message although > the function does work correctly. Is this just something I should > just ignore, or is there a way to stop the message from being sent > in the CRON report? For Bourne shell, classic /bin/sh, and related shells (zsh, ksh), you can use something like: case $- in *i*) # do stuff for an interactive shell echo "interactive" ;; *) # not interactive echo "not interactive" ;; esac Regards, -- -Chuck