Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ shar(1) — Amiga System V Release 4 Version 2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ar(1)

cpio(1)

find(1)

tar(1)

SHAR(1)  —  USER COMMANDS

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 around.  The files may contain any data, include executables.  Shar’s resulting package, written to standard output, is an editable file.  It is actually a shell script using sh(1) "here" documents to extract its contents into the appropriate places. 

The package is unpacked by running sh with the package name as an argument.  Its files are written to the pathnames recorded in the archive. 

If a directory is specified (and -d is not given) all files underneath that directory are archived. 

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

Shar attempts to protect the contained files from mail processing by prepending an at-sign to each line, if needed.  If the file contains sufficiently bizarre data, the data is transformed into hexadecimal and transformed back when the archive is unpacked. 

The access modes are preserved for both directories and files. 

Available options are:

−b Archive files under their basenames, regardless of the original pathnames specified.  The contents are thus unpacked into the current directory instead of to the originally-specified pathnames.  This allows you to archive files from many directories but unpack them into a single directory.  It also allows you to unpack, say, /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 insure that the contents were not damaged in transit.  This check will be performed automatically after unpacking. 

−Ddir Causes the archive to contain code that will advise the user if they are not in the directory specified by dir. If the user is not in dir the unpacking may be continued by responding yes to the archive’s question. 

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

−m Retain modification and access times on emitted files. 

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

−r Causes the archive to contain code that insists that the person unpacking it be a super-user.  This is useful for processing system archives. 

−s Error checking will be performed by 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 turns on the −v (verbose) option. 

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

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. 

EXAMPLE

To archive all files under your home directory:

cd; shar -cmos . 
   or
shar -cmos $HOME

 
To preserve your /dev directory:

shar -mor /dev >save_dev_files

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

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

FILES

/dev/tty
/tmp/unpack$$∗  (for unpacking non-ascii files)

DIAGNOSTICS

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

Non-zero exit status is returned upon trouble with arguments. 

SEE ALSO

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

BUGS

The modification & access time restoration doesn’t take time zones into account. 

Amiga Unix  —  Last change:

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