shar

This article is about the file format. For other uses, see Shar (disambiguation).

shar
Filename extension .shar
Type of format Archive format, shell script

In the Unix operating system, shar (an abbreviation of shell archive) is an archive format. A shar file is a shell script, and executing it will recreate the files. This is a type of self-extracting archive file. It can be created with the Unix shar utility. To extract the files, only the standard Unix Bourne shell sh is usually required.

Note that shar is not specified by the Single Unix Specification, so it is not formally a component of Unix, but a legacy utility.

Details

While the shar format has the advantage of being plain text, it poses a risk due to being executable;[1] for this reason the older and more general tar file format is usually preferred even for transferring text files. GNU provides its own version of shar in the GNU Sharutils collection.

unshar programs have been written for other operating systems but are not always reliable; shar files are shell scripts and can theoretically do anything that a shell script can do (including using incompatible features of enhanced or workalike shells), limiting their utility outside the Unix world.

The drawback of self-extracting shell scripts (any kind, not just shar) is that they rely on a particular implementation of programs; shell archives created with older versions of makeself,[2] for example, the original Unreal Tournament for Linux installer, fails to run on bash 3.x due to a change in how missing arguments to trap built-in command are handled.

Similar formats

In 1987, Michael Bednarek from The Melbourne Institute of Applied Economic and Social Research at the University of Melbourne developed a script for a similar purpose in the DIGITAL Command Language for the VMS operating system under the name "VMS_Shar version 2".[3]

The main purpose of this script was to allow the distribution of formatted program code through e-mail and Usenet newsgroups because:

  1. Mail transfer agents and NNTP server software only allowed printable ASCII characters (32126);
  2. They tended to strip leading and trailing blanks and TAB characters;
  3. And they usually broke lines longer than 80 characters. VMS_SHAR protected leading blanks, and it split long files into parts of less than 16,000 bytes.

Version 4 introduced the protection of trailing blanks using the TPU text editor which then became the main engine of the script. Version 5 protected control characters like TAB, ESC, BEL. In 1988, beginning with version 6, the script was then extended by James A. Gray from Xerox.[4] Starting with version 7, Andy Harper from King's College London continued the development;.[5] The current version (as of 2008) is 8.5 (1994)[6]

See also

References

  1. Apple (June 6, 1993). "Mac OS X shar(1) Man Page". Apple. Retrieved 2009-11-07.
  2. "makeself "trap" command fix". Svn.icculus.org. 2000-11-20. Retrieved 2011-08-30.
  3. Michael Bednarek (9 June 1987). "shar (sort of) for VMS". Newsgroup: comp.os.vms. Usenet: 1261@murdu.OZ. Retrieved 2008-02-09.
  4. Jim Gray (8 May 1988). "VMS_SHARE V6.0". Newsgroup: comp.os.vms. Usenet: 880508-073131-5929@Xerox. Retrieved 2008-02-09.
  5. Andy Harper (6 July 1989). "VMS_SHARE version 7". Newsgroup: comp.os.vms. Usenet: 8907061417.AA16991@ucbvax.Berkeley.EDU. Retrieved 2008-02-09.
  6. Andy Harper (5 July 1995). "Announcing VMS_SHARE 8.5". Newsgroup: vmsnet.sources.d. Usenet: 1994Jul5.164105.3667@bay.cc.kcl.ac.uk. Retrieved 2008-02-09.
This article is issued from Wikipedia - version of the 11/11/2016. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.