On Wednesday 18 February 2009 10:40:47 Warren Block wrote: > On Wed, 18 Feb 2009, 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. > > cron uses /bin/sh, not bash.
No. cron uses execvp, which will: 1) execute as binary if header is recognized 2) execute with whatever the she-bang says (#!) 3) run as /bin/sh /path/to/file if 1) and 2) fail. Can't reproduce the error though, using: #!/usr/local/bin/bash unset TERM sleep 1; if [ ! -t 0 ]; then echo No term >> out else echo term >> out fi I run as: daemon ./test.sh 2>err then logout the ssh session, so terminal becomes invalid. It correctly says term and no term, no tput errors. Same for /bin/sh, by the way. -- Mel Problem with today's modular software: they start with the modules and never get to the software part. _______________________________________________ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"