#!/bin/sh
if [ '`tty`' = "not a tty" ];then
echo "running in background"
else
echo "running in foreground"
fi
On 21 Apr 1999 19:29:28 GMT, "Gino Facini" <gino....@gov.nb.ca>
wrote:
Enjoy
-Greg
Are you using sh or ksh? If sh, the above solutions will work. If ksh (or
another job-control shell), the handling of background jobs is more refined
with the result that the above won't work. This method will work with both:
if {</dev/tty;} 2>/dev/null; then
echo "running in foreground"
else
echo "running in background"
fi
John
--
John DuBois spc...@armory.com. KC6QKZ http://www.armory.com./~spcecdt/