Edge Rewrite
// HTMLRewriter · presentation

This page was redesigned at the edge.

Cloudflare fetched the original article and streamed it through HTMLRewriter to apply an entirely new visual system without rebuilding the source page.

// request.cf · coarse context

A page that knows where it met you.

Only coarse request metadata is shown. This demo does not display or persist visitor IP addresses.

Country
US
Cloudflare location
CMH
Connection
HTTP/2
Language
Not provided

Ray ID: a40af26d9e93c60e

Jump to content

shar (file format)

From Wikipedia, the free encyclopedia
(Redirected from Shell archive)

shar
Original authorJames Gosling
DevelopersVarious open-source and commercial developers
Operating systemUnix, Unix-like, VMS, Windows
TypeCommand
shar
Filename extension
.shar
Type of formatArchive format, shell script
Open format?Yes[1]

In the Unix operating system, shar (from "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, and executing it will recreate the files. To extract the files, only the standard Unix Bourne shell sh is usually required.

shar files are also sometimes called "sharchives" (from "/bin/sh archive").[2]

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

[edit]

The shar format was developed before the advent of the MIME standard as a way to email one or more files, any of which could be text or binary. At the time, there was no portable way to reliably email a non-text file or a collection of files, e.g., a tar file format archive. Shar was also a common format for distributing software via Usenet, e.g., comp.sources.unix.

Today, MIME is the preferred method for emailing files as the shar format poses a risk due to being executable;[3]. For legacy reasons, GNU provides its own version of shar in the GNU Sharutils collection.

History and variants

[edit]

James Gosling is credited with writing the first version of the shar utility in 1982,[1]: §1  and also wrote an early example (allegedly 1978–79) of the concept in the form of this simple shell script:[4][5][6]

# 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:[7]

  • shar 1.x (1982) by Gosling. Public domain shell script.
  • 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 shar is available as a separate package for Microsoft Windows as part of the UnxUtils collection of native Win32 ports of common GNU Unix-like utilities.[8]

Similar formats

[edit]

A version of the same concept, but for the VMS operating system, was written in 1987 by Michael Bednarek from the Melbourne Institute of Applied Economic and Social Research as a DCL script, VMS_SHAR.COM.[9] This was later maintained and extended by James A. Gray from Xerox,[10] and Andy Harper from King's College London.[11][12]

makeself (2001–) is a shell script that generates self-extracting tarballs (*.run, application/x-makeself) 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.[13]

See also

[edit]

References

[edit]
  1. 1 2 "GNU 'shar' utilities". gnu.org. Free Software Foundation. Retrieved 8 December 2019.
  2. ↑ "sharchive". ftp.informatik.rwth-aachen.de. Retrieved 2 January 2024.
  3. ↑ Apple (6 June 1993). "Mac OS X shar(1) Man Page". Apple. Archived from the original on 7 November 2009. Retrieved 7 November 2009.
  4. ↑ uw-beave!jim (2 April 1983). "Re: program to separate xlisp distribution files". Newsgroup: net.sources. message-id:bnews.uw-beave.451. Retrieved 27 March 2017.
  5. ↑ "shar: a blast from the past". James Gosling: on the Java Road. Archived from the original on 27 March 2017. Retrieved 26 March 2017.
  6. ↑ An almost identical script, 'bundle', is described in The UNIX Programming Environment, Brian Kernighan & Rob Pike, 1984, p. 97
  7. ↑ Dickey, Thomas E. "Comments on Shar/Utils". invisible-island.net.
  8. ↑ Native Win32 ports of some GNU utilities
  9. ↑ Michael Bednarek (9 June 1987). "shar (sort of) for VMS". Newsgroup: comp.os.vms. Usenet: 1261@murdu.OZ. Retrieved 4 September 2024.
  10. ↑ Jim Gray (8 May 1988). "VMS_SHARE V6.0". Newsgroup: comp.os.vms. Usenet: 880508-073131-5929@Xerox. Retrieved 4 September 2024.
  11. ↑ Andy Harper (7 July 1989). "VMS_SHARE version 7". Newsgroup: comp.os.vms. Usenet: 8907061417.AA16991@ucbvax.Berkeley.EDU. Retrieved 4 September 2024.
  12. ↑ Andy Harper (6 July 1995). "Announcing VMS_SHARE 8.5". Newsgroup: vmsnet.sources.d. Usenet: 1994Jul5.164105.3667@bay.cc.kcl.ac.uk. Retrieved 4 September 2024.
  13. ↑ "makeself – Make self-extractable archives on Unix".
[edit]