Why was shar written if tar already existed?

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?

Answer

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:

Attribution
Source : Link , Question Author : Josh Williams , Answer Author : Thomas Dickey

Leave a Comment