:
#........................................................................
#:									:
#: batch -- Run a background shell script independent of login status.	:
#:	Copyright 1985 by G.R.A.M. Associates - For the Public Domain	:
#:									:
#:	Usage:	batch [-] [file ...]					:
#:		where:	file	is 0 or more files containing shell	:
#:				scripts 				:
#:			- 	indicates standard input.		:
#:									:
#:	Files:	$HOME/mmddhhmmss (temporary file removed after use)	:
#:									:
#:  G.R.A.M. Associates assumes no responsibility for any use or misuse	:
#: of this program.  Please don't remove this header.			:
#:......................................................................:

FILE=$HOME/`date '+%m%d%H%M%S'`		# Make a unique file name
( cat $* ; echo rm -f $FILE ) > $FILE	# Need a separate process for input
nohup sh -c "sh $FILE 2>&1 | mail $LOGNAME" 2>&1 >/dev/null &	# Run it
echo batch: Executing $FILE		# Let 'em know its running
