Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ shar(1) — HP-UX 6.20

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ar(1)

compress(1)

cpio(1)

find(1)

tar(1)

SHAR(1)  —  HP-UX

NAME

shar − make a shell archive package

SYNOPSIS

shar [ options ] [ file | dir ] ...  > package

DESCRIPTION

Shar bundles the named files into a single distribution package suitable for mailing or moving.  The files can contain any data, including executables.  The resulting package, written to standard output, is a shell script file that can be edited. 

The package is unpacked by running sh(1) with the package name as an argument. For example, the user would type sh package on the command line to unpack package. The files in package are written to the path names recorded in the archive. 

If a directory is specified and the −d option is not given, all files beneath that directory are archived. 

If a special file is specified, the appropriate mknod(1) commands are emitted to recreate the file.

Shar protects the contained files from mail processing by inserting an @ (the "at" symbol) at the beginning of each line, if necessary.  If the file contains unusual data, the data are transformed into uuencode format.  The uuencode data are also unpacked with sh. 

The access modes are preserved for both directories and files. 

Options

−a Assume that files can be shipped, regardless of their contents; do not protect them specially.  Shar is conservative, and might decide to uuencode a file containing special characters (for example, control-G) that the user knows do not need protection. 

−b Archive files under their base names, regardless of the original path names specified.  The contents are thus unpacked into the current directory instead of to the originally specified path names.  This allows you to archive files from many directories but unpack them into a single directory.  It also allows you to unpack /etc/termcap into ./termcap instead of overwriting the original one in /etc. 

−c Append to the package a simple data-integrity check using wc(1) to ensure that the contents were not damaged in transit. This check is performed automatically after unpacking.

−C Insert a line of the form "--- cut here ---" before the archive. 

−d If a directory is specified, do not transmit its contents, but rather only create the empty directory. 

−Ddir Cause the archive to contain code that notifies the user if the user’s current directory is not specified by dir. If the user is not in dir, the unpacking can be continued by responding yes to the archive’s question. 

−e Cause the archive to contain code that prevents shar from unpacking files that would overwrite existing files. 

−f file Read a list of file names from file and archive those files as though they were given as arguments. 

−m Retain modification and access times on files when they are unpacked. 

−o Preserve user and group ownership on files and directories. 

−r Cause the archive to contain code that insists that the user unpacking it be a superuser.  This is useful for processing system archives. 

−s Perform error checking using sum(1). Both −c and −s may be specified for better error checking. 

−t Write diagnostics and messages directly to your terminal, instead of to the standard error.  This is useful when invoking shar from programs such as vi(1), which normally combine standard error with standard output. Specifying −t also invokes the −v (verbose) option. 

−u Assume that the remote site has uudecode for unpacking.  If this option is not specified, a version of uudecode is sent and compiled if any non-ASCII files are archived. 

−v Announce archived file names as they are packed.  The −t option determines the destination for these announcements. 

−Z Compress files using compress(1).

Most options are flagged in the header of the resulting package, thereby recording the format of the archive.  The name of the archiver, system, and time/date of the archive are also recorded in the header. 

EXAMPLES

To archive all files under your home directory, type:

cd; shar -cmos . 

or

shar -cmos $HOME

To preserve your /dev directory, type:

shar -mor /dev >save_dev_files

To send your newest programs in directory newstuff in your home directory to a friend, type:

cd; shar -cmos newstuff | mailx -s ’new source’ friend

DIAGNOSTICS

If the −b option is specified, shar refuses to archive directories. 

Non-zero exit status is returned when problems with arguments occur. 

WARNINGS

The modification and access time restoration does not take time zones into account. 

Files with newlines in their names scramble the table of contents. 

Non-ASCII files with white space in their names do not unpack. 

DEPENDENCIES

Series 800
The −a, −e, −f, and −Z options are not currently supported. 

AUTHOR

Shar was invented in the public domain.  This version of shar was developed by HP. 

FILES

/dev/tty
/tmp/unpack$$*  (for unpacking non-ASCII files)

SEE ALSO

ar(1), compress(1), cpio(1), find(1), tar(1). 

Hewlett-Packard Company  —  May 11, 2021

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026