Shar
Encyclopedia
In the Unix
Unix
Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...

 operating system
Operating system
An operating system is a set of programs that manage computer hardware resources and provide common services for application software. The operating system is the most important type of system software in a computer system...

, shar (an abbreviation of shell archive) is an archive format
Archive format
An archive format is the file format of an archive file. The archive format is determined by the file archiver. Some archive formats are well-defined by their authors and have become conventions supported by multiple vendors and/or open-source communities....

. A shar file is a shell script
Shell script
A shell script is a script written for the shell, or command line interpreter, of an operating system. It is often considered a simple domain-specific programming language...

, and executing it will recreate the files. This is a type of self-extracting archive
Self-extracting archive
A self-extracting archive is a computer application which contains a file archive, as well as programming to extract this information. Such file archives do not require a second executable file or program to extract from the archive, as archive files usually require...

 file. It can be created with the Unix shar utility. To extract the files, only the standard Unix
Unix
Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...

 Bourne shell
Bourne shell
The Bourne shell, or sh, was the default Unix shell of Unix Version 7 and most Unix-like systems continue to have /bin/sh - which will be the Bourne shell, or a symbolic link or hard link to a compatible shell - even when more modern shells are used by most users.Developed by Stephen Bourne at AT&T...

 sh is usually required.

Details

While the shar format has the advantage of being plain text
Plain text
In computing, plain text is the contents of an ordinary sequential file readable as textual material without much processing, usually opposed to formatted text....

, it poses a risk due to being executable
Executable
In computing, an executable file causes a computer "to perform indicated tasks according to encoded instructions," as opposed to a data file that must be parsed by a program to be meaningful. These instructions are traditionally machine code instructions for a physical CPU...

; for this reason the older and more general tar file format
Tar (file format)
In computing, tar is both a file format and the name of a program used to handle such files...

 is usually preferred even for transferring text files. GNU
GNU
GNU is a Unix-like computer operating system developed by the GNU project, ultimately aiming to be a "complete Unix-compatible software system"...

 provides its own version of shar in the GNU Sharutils
GNU Sharutils
GNU Sharutils is a set of utilities to handle shell archives. The GNU shar utility produces a single file out of many files and prepares them for transmission by electronic mail services, for example by converting binary files into plain ASCII text. A shell archive is a collection of files that can...

 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, for example the original Unreal Tournament
Unreal Tournament
Unreal Tournament is a futuristic first-person shooter video game co-developed by Epic Games and Digital Extremes. It was published in 1999 by GT Interactive. Retrospectively, the game has also been referred to as UT99 or UT Classic to differentiate it from its numbered sequels...

 for Linux installer, fails to run on bash 3.x due to a change in how missing arguments to trap built-in command
Shell builtin
In computing, a shell builtin is a command or a function, called from a shell, that is executed directly in the shell itself, instead of an external executable program which the shell would load and execute....

 are handled.

Similar formats

In 1987, Michael Bednarek from The Melbourne Institute of Applied Economic and Social Research
The Melbourne Institute of Applied Economic and Social Research
The Melbourne Institute of Applied Economic and Social Research is an Australian economic research institute based in Melbourne, Victoria...

 at the University of Melbourne
University of Melbourne
The University of Melbourne is a public university located in Melbourne, Victoria. Founded in 1853, it is the second oldest university in Australia and the oldest in Victoria...

 developed a script for a similar purpose in the DIGITAL Command Language
DIGITAL Command Language
DCL, the DIGITAL Command Language, is the standard command languageadopted by most of the operating systems that were sold by the former Digital Equipment Corporation...

 for the VMS
OpenVMS
OpenVMS , previously known as VAX-11/VMS, VAX/VMS or VMS, is a computer server operating system that runs on VAX, Alpha and Itanium-based families of computers. Contrary to what its name suggests, OpenVMS is not open source software; however, the source listings are available for purchase...

 operating system under the name "VMS_Shar version 2".

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
    Network News Transfer Protocol
    The Network News Transfer Protocol is an Internet application protocol used for transporting Usenet news articles between news servers and for reading and posting articles by end user client applications...

     server software only allowed printable ASCII
    ASCII
    The American Standard Code for Information Interchange is a character-encoding scheme based on the ordering of the English alphabet. ASCII codes represent text in computers, communications equipment, and other devices that use text...

     characters (32–126);
  2. They tended to strip leading and trailing blanks and TAB
    Tab key
    Tab key on a keyboard is used to advance the cursor to the next tab stop.- Origin :The word tab derives from the word tabulate, which means "to arrange data in a tabular, or table, form"...

     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 Processing Utility
DEC Text Processing Utility was a language developed by Digital Equipment Corporation for developing text editors. In 1986, DEC developed a new version of EDT written in DECTPU. DECTPU is distributed with OpenVMS...

 text editor editor which then became the main engine of the script. Version 5 protected control characters like TAB, ESC
Esc key
On computer keyboards, the Esc key is a key labeled Esc or Escape that is used to generate the ASCII Escape character , the character code traditionally used to initiate an escape sequence...

, BEL
Bell character
A bell code is a device control code originally sent to ring a small electromechanical bell on tickers and other teleprinters and teletypewriters to alert operators at the other end of the line, often of an incoming message...

. In 1988, beginning with version 6, the script was then extended by James A. Gray from Xerox
Xerox
Xerox Corporation is an American multinational document management corporation that produced and sells a range of color and black-and-white printers, multifunction systems, photo copiers, digital production printing presses, and related consulting services and supplies...

. Starting with version 7, Andy Harper from King's College London
King's College London
King's College London is a public research university located in London, United Kingdom and a constituent college of the federal University of London. King's has a claim to being the third oldest university in England, having been founded by King George IV and the Duke of Wellington in 1829, and...

continued the
development;. The current version (as of 2008) is 8.5 (1994)

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK