From owner-freebsd-questions@FreeBSD.ORG Wed Feb 18 19:40:49 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 1E7D11065672 for ; Wed, 18 Feb 2009 19:40:49 +0000 (UTC) (envelope-from wblock@wonkity.com) Received: from wonkity.com (wonkity.com [67.158.26.137]) by mx1.freebsd.org (Postfix) with ESMTP id C6FEC8FC12 for ; Wed, 18 Feb 2009 19:40:48 +0000 (UTC) (envelope-from wblock@wonkity.com) Received: from wonkity.com (localhost [127.0.0.1]) by wonkity.com (8.14.3/8.14.3) with ESMTP id n1IJelv3015718 for ; Wed, 18 Feb 2009 12:40:47 -0700 (MST) (envelope-from wblock@wonkity.com) Received: from localhost (wblock@localhost) by wonkity.com (8.14.3/8.14.3/Submit) with ESMTP id n1IJelgJ015715; Wed, 18 Feb 2009 12:40:47 -0700 (MST) (envelope-from wblock@wonkity.com) Date: Wed, 18 Feb 2009 12:40:47 -0700 (MST) From: Warren Block To: GESBBB In-Reply-To: <502804.7096.qm@web32108.mail.mud.yahoo.com> Message-ID: References: <502804.7096.qm@web32108.mail.mud.yahoo.com> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-1244918271-1234986047=:15654" X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.0.1 (wonkity.com [127.0.0.1]); Wed, 18 Feb 2009 12:40:48 -0700 (MST) 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 19:40:49 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-1244918271-1234986047=:15654 Content-Type: TEXT/PLAIN; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: 8BIT On Wed, 18 Feb 2009, GESBBB wrote: > I am using this snippet of code in a bash script that is run via CRON. >   > > # See if we are running via CRON >     if [ ! -t 0 ] >       then > # Use the BASH RANDOM function to generate a random number between 0 & 32767 >         RESTING=$((RANDOM/60)) >         sleep ${RESTING} >     fi > >   >   > It runs fine from the console; however, when run via CRON, it outputs this error message. >   > Tput: No terminal type specified and no TERM environmental variable. >   > I have Googled about, yet I cannot find an answer. Perhaps some Bash guru can assist me. cron uses /bin/sh, not bash. -Warren Block * Rapid City, South Dakota USA --0-1244918271-1234986047=:15654--