Preparing Files for Extraction

The WITNESS bsa at ncoast.UUCP
Sat Sep 8 04:02:37 AEST 1984


[gollum :-)]

> From: rose at uw-june.UUCP

> Files submitted to net.sources are prepared for submission in such a fashion
>   that they may be simply extracted using sh.  How is this done?

It can be done fairly easily.  I have the following shell script, not great but
it works:
============================================================
: shar - shell script maker for "archiving" FTP on net.sources

if [ $# -eq 0 ]
then	echo "usage: shar file1 file2 ..."
	exit 1
elif [ $# -eq 1 ]
then	echo "usage: shar file1 file2 ..."
	exit 1
fi
FILE=/tmp/shar$$
echo 'Output will be in shar.out'
>$FILE
for file
do	if [ ! -r $file ]
	then	echo "shar: $file cannot be read" >&2
		continue
	fi
	echo "shar - `basename $file`"
	echo "echo 'sh - `basename $file`'" >>$FILE
	echo "sed 's/^X//' <<'________This_Is_The_END________' >>`basename $file`" >>$FILE
	sed 's/^/X/' <$file >>$FILE
	echo '________This_Is_The_END________' >>$FILE
done
mv $FILE shar.out || echo "shar:  could not make shar.out: output is in $FILE" >&2
============================================================
It could be simplified a little, but our 'test' is stupid and chokes on -a and
-o (AND and OR).

--bsa



More information about the Comp.sources.unix mailing list