# non-commercial use provided that this notice appears in
# all copies of the file.  There is no warranty, either
# expressed or implied, supplied with this code.
#
# NAME
#    Shar - create a shell archive
#
# SYNOPSIS
#    Shar file [...]
#
# DESCRIPTION
#    This command creates a shell archive that contains the
#    files listed on the command line.  The shell archive
#    is written to the standard output.  To unpack the
#    archive, enter the following command, where archive is
#    the name of the shell archive.
#
#         sh archive
#
# RETURN VALUE
#    0    Successful completion
#    1    Usage error
#
############################################################
CMDNAME=`basename $0`
if [ $# -lt 1 ]; then
     echo "Usage: $CMDNAME file ..." 1>&2
     exit 1
fi

echo "#!/bin/sh"
echo "# This is a shell archive; to unpack:"
echo "# 1. Remove everything before the \"#!/bin/sh\"."
echo "# 2. Save the rest of the archive."
echo "# 3. Execute the archive by entering \"sh archive\"."
echo "#"
echo "# This archive contains the following files:"
echo "#"

for FILE
do
     echo "#    $FILE"
done

for FILE
do
     echo ""
     echo "if [ -f $FILE ]; then"
     echo "    echo The file $FILE already exists."
     echo "else"
     echo "    echo Extracting $FILE"
     echo "    sed 's/^X//' >$FILE <<\EOF"

This file was created with man2html