hold -- a program to buffer input

Jerry Peek jerryp at cmx.npac.syr.edu
Tue Aug 9 00:29:46 AEST 1988


[Sorry for posting this.  Mail to him bounced.]

In article <4623 at whuts.UUCP> wsd at whuts.UUCP (54299-DINSMORE,W.S.) writes:
> 
> 	Would someone please me a way to do this in the C_Shell?

Here it is.

--Jerry Peek, Northeast Parallel Architectures Center, Syracuse, NY
  jerryp at cmx.npac.syr.edu
  +1 315 443-1722

-----  CUT HERE -----------------------------------------------------------
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	hold.csh
# This archive created: Mon Aug  8 10:26:18 1988
export PATH; PATH=/bin:$PATH
if test -f 'hold.csh'
then
	echo shar: will not over-write existing file "'hold.csh'"
else
cat << \SHAR_EOF > 'hold.csh'
#! /bin/csh -f
if ( $#argv > 1 ) then
  # USE sh TO PUT ERROR ON stderr:
  sh -ce "echo 'Usage: hold [file]' 1>&2"
  exit 1
endif

onintr cleanup
set f=/tmp/hold.$$

cat > $f
switch ($#argv)
case 0:
   cat $f; breaksw
case 1:
   cat $f > "$1"; breaksw
endsw

cleanup:
	/bin/rm -f $f
	exit 0
SHAR_EOF
chmod +x 'hold.csh'
fi # end of overwriting check
#	End of shell archive
exit 0



More information about the Alt.sources mailing list