Problem with BASH and [ ! -t 0 ] test.

Matthew Seaman m.seaman at infracaninophile.co.uk
Wed Feb 18 07:55:53 PST 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160

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.
|
| I have Googled about, yet I cannot find an answer. Perhaps some Bash
guru can assist me.
|

jot -r 1 0 546

	Cheers,

	Matthew

- --
Dr Matthew J Seaman MA, D.Phil.                       Flat 3
~                                                      7 Priory Courtyard
PGP: http://www.infracaninophile.co.uk/pgpkey         Ramsgate
~                                                      Kent, CT11 9PW, UK
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.10 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEAREDAAYFAkmcL3YACgkQ8Mjk52CukIxn9ACePfwIwfNo1q1Sp6zPm9zDB4fh
uhcAnjskxg142o6FeMRNLJwrIMZwJFGi
=VPTj
-----END PGP SIGNATURE-----


More information about the freebsd-questions mailing list