shar: a blast from the past

John Gilmore was going through some old backup cartridge tapes. He stumbled on the following email. "shar" was old in 82... I think I actually wrote the script in the email in 78 or 79.

Bits and memes never die.

From decwrl!decvax!microsof!uw-beave!jim Mon Oct 18 11:08:34 1982
Subject: Shell archiver
Newsgroups: net.sources

I see a lot of sources posted here which consist of several files, all
catted together, and then I have to edit the source to extract all the
files.  Here is a simple shell script which will package up a bunch of files
into a "shell archive", which when used as input to a shell, will extract
the constituent files (is that perfectly clear?).  For example, if I want to
distribute a program consisting of files foo1.c, foo2.c, and makefile, I
would type "shar archive foo1.c foo2.c makefile" and I would then post
"archive" to the net.  Recipients would then run the archive into their
shell and would get back the original files.  Here it is:

# shar -- Shell archiver
AR=$1
shift
for i do
        echo a - $i
        echo "echo x - $i" >>$AR
        echo "cat >$i <<'!Funky!Stuff!'" >>$AR
        cat $i >>$AR
        echo "!Funky!Stuff!" >>$AR
done

Thanks to James Gosling at CMU for this idea.
March 3, 2006