Date: Thu, 19 Feb 2009 13:40:01 +1300 From: Jonathan Chen <jonc@chen.org.nz> To: GESBBB <gesbbb@yahoo.com> Cc: FreeBSD Users Questions <freebsd-questions@freebsd.org> Subject: Re: Problem with BASH and [ ! -t 0 ] test. Message-ID: <20090219004001.GA53921@osiris.chen.org.nz> In-Reply-To: <502804.7096.qm@web32108.mail.mud.yahoo.com> References: <502804.7096.qm@web32108.mail.mud.yahoo.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Feb 18, 2009 at 07:18:03AM -0800, GESBBB wrote:
> I am using this snippet of code in a bash script that is run via CRON.
> ?
> ?
> <snippet>
> # 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
> </snippet>
> ?
> ?
> 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.
Bash is looking up the user's bash startup-scripts, and one of the
script commands assumes that it's running on a terminal.
--
Jonathan Chen <jonc@chen.org.nz>
----------------------------------------------------------------------
"In mathematics you don't understand things.
You just get used to them."
- Johann von Neumann
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090219004001.GA53921>
