The Full Wiki

Shar: Wikis


Note: Many of our articles have direct quotes from sources you can cite, within the Wikipedia article! This article doesn't yet, but we're working on it! See more info or our list of citable articles.


(Redirected to shar article)

From Wikipedia, the free encyclopedia

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.



While the shar format has the advantage of being plain text, it poses a risk due to being executable[1][2]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[3], 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 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".[4]

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 (32–126);
  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 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[5]. Starting with version 7, Andy Harper from King's College London continued the development;[6]. The current version (as of 2008) is 8.5 (1994)[7]

See also


  1. ^ Apple (June 6, 1993). "Mac OS X Man Page". Apple. Retrieved 2009-11-07.  
  2. ^ "Babylon Shar definition". Babylon Free Dictionary. Retrieved 2009-11-07.  
  3. ^ makeself “trap” command fix
  4. ^ Michael Bednarek (9 June 1987). "shar (sort of) for VMS". comp.os.vms. (Web link). Retrieved on 2008-02-09.
  5. ^ Jim Gray (8 May 1988). "VMS_SHARE V6.0". comp.os.vms. (Web link). Retrieved on 2008-02-09.
  6. ^ Andy Harper (6 July 1989). "VMS_SHARE version 7". comp.os.vms. (Web link). Retrieved on 2008-02-09.
  7. ^ Andy Harper (5 July 1995). "Announcing VMS_SHARE 8.5". vmsnet.sources.d. (Web link). Retrieved on 2008-02-09.

External links

Got something to say? Make a comment.
Your name
Your email address