HP-UX Reference (11i v2 07/12) - 1 User Commands N-Z (vol 2)

s
shar(1) shar(1)
NAME
shar - make a shell archive package
SYNOPSIS
shar [options][filedir] ...
> package
DESCRIPTION
The
shar command bundles the named files and directories 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 (to add messages at the beginning, etc.).
To unpack package, use the sh
command with the package name as an argument as follows:
sh package
When unpacking, the files and directories 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 commands are emitted to recreate the file (see
mknod(1M)).
shar protects the contained files from mail processing, if necessary, by inserting an @ character at the
beginning of each line. If the file contains unusual data, the data is transformed into
uuencode
format,
and a
uudecode script is included in package so that the package can still be unpacked correctly by
sh.
See WARNINGS for more information about mailers and file modifications.
Access modes are preserved for both directories and files.
Options
shar recognizes the following options:
-a Assume that files can be shipped, regardless of their contents; do not protect them spe-
cially. shar is conservative, and might decide to
uuencode a file containing special char-
acters (such as Ctrl-G) that the user knows do not need protection.
-A Suppress warning messages regarding optional access control list entries. shar does not
archive optional access control list entries in a file’s access control list (see acl(5)). Nor-
mally, a warning message is printed for each file having optional access control list entries.
-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, for example,
/usr/share/lib/termcap
into ./termcap instead of overwriting the original one
in
/etc.
-c Append to the package a simple data-integrity check using
wc to ensure that the contents
were not damaged in transit (see wc(1)). This check is performed automatically after
unpacking. Also see WARNINGS below.
-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 his or her current directory is not
the same as dir, which must be an absolute path. If the user is not in dir, the unpacking
can be continued by responding yes to the archives question.
-e Cause the archive to contain code that prevents shar from unpacking files that would
overwrite existing files.
-ffile Read a list of file names from file and archive those files as if they were given as argu-
ments.
-h Follow symbolic links as if they were normal files or directories. If this option is not
specified, shar archives the link.
-m Retain modification and access times on files when they are unpacked.
292 Hewlett-Packard Company 1 HP-UX 11i Version 2: December 2007 Update