Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (HP-UX-11.11)
Apropos / Subsearch:
optional field

 shar(1)							     shar(1)

      shar - make a shell archive package

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

      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.

      shar recognizes the following 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 (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)).	 Normally, a warning message is
		     printed for each file having optional access control
		     list entries.

 Hewlett-Packard Company	    - 1 -   HP-UX Release 11i: November 2000

 shar(1)							     shar(1)

	   -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

	   -C	     Insert a line of the form --- cut here --- before the

	   -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 archive's question.

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

	   -ffile    Read a list of file names from file and archive those
		     files as if they were given as arguments.

	   -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.

	   -o	     Preserve user and group ownership on files and

	   -r	     Cause the archive to contain code requiring that the
		     user unpacking it be root.	 This is useful for
		     processing system archives.

	   -s	     Perform error checking using sum (see sum(1)).  Both -c
		     and -s can be specified for better error checking.
		     Also see WARNINGS below.

 Hewlett-Packard Company	    - 2 -   HP-UX Release 11i: November 2000

 shar(1)							     shar(1)

	   -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
		     that normally combine standard error with standard
		     output.  Specifying -t also invokes the -v (verbose)

	   -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

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

	   -Z	     Compress files using compress (see 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.

      To archive all files under your home directory, type:

	   cd; shar -cmos .


	   shar -cmos $HOME

      To preserve your /dev directory, type:

	   shar -mor /dev >&gt&gt>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

      shar returns zero if successful; nonzero if problems with arguments

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

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

 Hewlett-Packard Company	    - 3 -   HP-UX Release 11i: November 2000

 shar(1)							     shar(1)

      Files with newline characters in their names scramble the table of

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

      If a mailer such as elm(1) is used to transfer package to another
      system and the mailer is configured to expand tabs (by default or
      otherwise), any file in the archive will be modified if it contains
      tabs.  If the -c or -s option is used to create the archive, the
      data-integrity check will fail during unpacking of any files in
      package that contain tab characters that were converted to spaces.
      (Some mailers that expand tabs when transferring files over a network
      may or may not expand tabs when transferring files to the sender or
      other users on the local system.) If an editor is used to modify any
      of the files in package, the data-integrity check will also fail for
      the files that were changed.

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


      /var/tmp/unpack$$*     (For unpacking non-ASCII files if /var/tmp is

      /tmp/unpack$$*	     (for unpacking non-ASCII files if /var/tmp is
			     not available)

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

 Hewlett-Packard Company	    - 4 -   HP-UX Release 11i: November 2000