4

According to the BSD man pages, tar first appeared in Version 7 UNIX in 1979, but shar first appeared in 4.4BSD, which was released in 1994.

What were the perceived advantages to shar at the time? Shar introduces a host of security issues since it's just executing a lengthy shell script. Why would this tool be introduced when tar already provided similar functionality?

3
  • 2
    Obligatory xkcd: xkcd.com/1168
    – muru
    Apr 5 '16 at 17:55
  • 2
    My conjecture would be that tar requires, well, tar, and, at that point, probably uudecode since tar archives are not 7-bit clean, whereas shar only requires sh. Apr 5 '16 at 18:30
  • Before shar there were other tools for creating shell archives, I definitely used those archives before 1990
    – Anthon
    Apr 5 '16 at 20:27
5

Depending on the source (and weight you may attach), shar dates back to around 1980. In a form which you might recognize, that comes from Rich Salz's implementation introduced in 1988, and improved in stages over the next few years.

shar was originally a convenience for bundling text files. uuencoding (a way to send binary files) has been around at least as long: I see it in 2.0BSD, dated 1989 with the manual page saying it was written by Mark Horton. It was in use with shar in the 1980s, though the earliest use in combination with shar is elusive. The README in Rich Salz's 1988 version of cshar states:

On a philosophical note, I've tried to make this all as general as
possible for shipping sources around.  I'm not interested in binaries, so
things like automatically running uuencode don't interest me a great
deal.  I haven't come up with a good portable way to split files into
pieces if they're too large, and doubt I ever will.  There are too many 
installation parameters, but I'm not particularly worried about that:  Once
you get things working, consider it incentive to avoid future changes.  
It would be nice if I could use Larry's meta-Config, but that only works 
on Unix (and Eunice).  Send me your config.h file so that others can benefit.

However, William Davidsen's concurrent (a month earlier) shar2 in comp.sources.misc (Volume 3, Issue 14) supported uuencode.

Further reading:

3

You are mistaken, shell archivers did exist no later than 1980.

They have been written for the usenet source archives in order to allow the archives to appear inside a mail. Tar is binary and cannot easily be in a usenet source archive.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.