[net.sources] shell script to generate shar files

dat@hpcnoe.UUCP (dat) (12/08/84)

	By popular demand, herein is enclosed a bourne shell 
script that will produce a shell-archive format file of all
the files in the users current directory when executed.  Usage
is quite simple: save this file to 'shar', chmod +x shar and
then shar <output file name>.  It does the rest!

	(Hopefully this will result in more stuff being submitted
to the net!)

					Dave Taylor
					Colorado Networks Operation

				..hpfcla!hpcnoe!dat

or, my own machine:		..hpfcla!hpcnoe!veeger!eunich!dat

------------------- cut, as they say, here -----------------


# sh script generates a shell archive containing all files in the
#    current directory.  It uses /tmp/$1 as a temporary output file
#    then moves that file to $1...
#
# Note that if the first character of this file is NOT a hash
# symbol (#) this script will ALSO work under the csh shell!!
# (check the manual if you don't believe me!)
#

if [ $# -lt 1 ] 
 then
  echo Usage: $0 \<output filename\>
  exit 1
 fi

rm -f /tmp/$1 $1

for file in * 
{
  echo Archiving file $file
  echo "# -------- $file --------" >> /tmp/$1
  echo "echo extracting file $file" >> /tmp/$1
  echo "cat \<\< THE_END \> $file" >> /tmp/$1
  cat $file >> /tmp/$1
  echo "THE_END" >> /tmp/$1
}

echo echo Done with extraction >> /tmp/$1

mv /tmp/$1 $1

echo Done

# ---------- cut this line out if you want to, too! 
# ---------- This is actually the last line of the file!