Shar Mountain National Park
   HOME

TheInfoList



OR:

In the Unix operating system, shar (an abbreviation of ''shell archive'') is an archive format created with the Unix shar utility. A shar file is a type of self-extracting archive, because it is a valid
shell script A shell script is a computer program designed to be run by a Unix shell, a command-line interpreter. The various dialects of shell scripts are considered to be scripting languages. Typical operations performed by shell scripts include file manip ...
, and executing it will recreate the files. To extract the files, only the standard Unix
Bourne shell The Bourne shell (sh) is a Shell (computing), shell Command-line interface#Command-line interpreter, command-line interpreter for computer operating systems. The Bourne shell was the default Unix shell, shell for Version 7 Unix. Unix-like syste ...
''sh'' is usually required. Note that the shar command 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 In computing, executable code, an executable file, or an executable program, sometimes simply referred to as an executable or binary, causes a computer "to perform indicated tasks according to encoded instruction (computer science), instructi ...
; 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 may rely on a particular implementation of programs; shell archives created with older versions of ''makeself'', 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.


History and variants

James Gosling is credited with writing the first version of the ''shar'' utility in 1982, and also wrote an early example (allegedly 1978-79) of the concept in the form of this simple shell script: # shar -- Shell archiver AR=$1 shift for i do echo a - $i echo "echo x - $i" >>$AR echo "cat >$i <<'!Funky!Stuff!'" >>$AR cat $i >>$AR echo "!Funky!Stuff!" >>$AR done The following variants of ''shar'' are known: * ''shar 1.x'' (1982) by Gosling. Public domain
shell script A shell script is a computer program designed to be run by a Unix shell, a command-line interpreter. The various dialects of shell scripts are considered to be scripting languages. Typical operations performed by shell scripts include file manip ...
. ** Current
FreeBSD FreeBSD is a free and open-source Unix-like operating system descended from the Berkeley Software Distribution (BSD), which was based on Research Unix. The first version of FreeBSD was released in 1993. In 2005, FreeBSD was the most popular ...
''shar''.
3-clause BSD license BSD licenses are a family of permissive free software licenses, imposing minimal restrictions on the use and distribution of covered software. This is in contrast to copyleft licenses, which have share-alike requirements. The original BSD lice ...
, shell script. Adds md5sum. * ''shar2'' or ''xshar'' (1988) by William Davidsen. Public domain, C program. ** ''shar3'' (1989) by Warren Tucker. *** ''shar 3.49'' (1990) by Richard H. Gumpertz. Adds uuencode support. **** Current GNU ''sharutils''. GPLv3, C program. * ''cshar'' (1984) by Michael A. Thompson and Mark Smith, now lost to bitrot. C program. * ''cshar'' (1988) by Rich Salz, C program. Likely influenced ''shar 3.49''. ** ''ccshar'' (1996), a modification to output a csh script instead. Rarely used on Usenet. GNU is available as a separate package for
Microsoft Windows Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for serv ...
as part of the UnxUtils collection of
native Native may refer to: People * Jus soli, citizenship by right of birth * Indigenous peoples, peoples with a set of specific rights based on their historical ties to a particular territory ** Native Americans (disambiguation) In arts and entert ...
Win32 ports of common GNU Unix-like utilities.


Similar formats

A version of the same concept, but for the
VMS #REDIRECT VMS {{redirect category shell, {{R from other capitalisation{{R from ambiguous page ...
operating system, was written in 1987 by Michael Bednarek from
The Melbourne Institute of Applied Economic and Social Research The Melbourne Institute of Applied Economic and Social Research (often simply referred to as "The Melbourne Institute") is an Australian Economics, economic research institute based in Melbourne, Victoria (Australia), Victoria. The institute is ...
as a
DCL DCL or may refer to: * 650 in Roman numerals, see 650 (disambiguation) Computers * Data Center Linux, see Open Source Development Labs * Data Control Language, a subset of SQL * Dialog Control Language, a language and interpreter within AutoC ...
script, VMS_SHAR.COM. This was later maintained and extended by James A. Gray from Xerox, and Andy Harper from
King's College London King's College London (informally King's or KCL) is a public research university located in London, England. King's was established by royal charter in 1829 under the patronage of King George IV and the Duke of Wellington. In 1836, King's ...
. ''makeself'' (2001–) is a shell script that generates self-extracting
tarball Tarball may refer to: * Tarball (computing), a type of archive file * Tarball (oil), a blob of semi-solid oil found on or near the ocean {{Disambiguation ...
s (, ) using the same shell script header technique. Using tar precludes makeself from being used in plain text directly, but the better compression and other functionalities has made it more popular in the 21st century among software vendors seeking to package Linux software.


See also

* List of Unix commands


References


External links

*
Information about shar files (Carnegie Mellon)GNU sharutils
{{Archive formats Unix archivers and compression-related utilities Archive formats