Invoking unshar
===============

Unshar scans the input files (typically email messages) looking for the start of a shell archive.  If no files are given, then standard input is processed instead.  It then passes each archive discovered through an invocation of the shell program to unpack it.

This section was generated by AutoGen, using the agtexi-cmd template and the option descriptions for the unshar program. This software is released under the GNU General Public License, version 3 or later.

unshar help/usage (--help)
--------------------------

This is the automatically generated usage text for unshar.

The text printed is the same whether selected with the help option (--help) or the more-help option (--more-help).  more-help will print the usage text by passing it through a pager program. more-help is disabled on platforms without a working fork(2) function.  The PAGER environment variable is used to select the program, defaulting to more.  Both will exit with a status code of 0.

     unshar (GNU sharutils) - unpack a shar archive
     Usage:  unshar [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [<file>...]

        -d, --directory=DIR        unpack into the directory DIR
        -c, --overwrite            overwrite any pre-existing files
        -f, --force                an alias for the 'overwrite' option
        -E, --split-at=SPLIT-PAT   split input on SPLIT-PAT lines
        -e, --exit-0               split input on "exit 0" lines
                                     - prohibits the option 'split-at'
        -D, --debug                debug the shell code
        -v, --version[=MODE]       output version information and exit
        -h, --help                 display extended usage information and exit
        -!, --more-help            extended usage information passed thru pager
        -R, --save-opts[=FILE]     save the option state to the config file FILE
        -r, --load-opts=FILE       load options from the config file FILE
                                     - disabled as '--no-load-opts'
                                     - may appear multiple times

     Options are specified by doubled hyphens and their name or by a single
     hyphen and the flag character.

     If no arguments are provided, input arguments are read from stdin,
     one per line; blank and '#'-prefixed lines are comments.
     'stdin' may not be a terminal (tty).

     The following option preset mechanisms are supported:
      - reading file $HOME/.sharrc

     'unshar' scans the input files (typically email messages) looking for the
     start of a shell archive.  If no files are given, then standard input is
     processed instead.  It then passes each archive discovered through an
     invocation of the shell program to unpack it.

     Please send bug reports to:  <bug-gnu-utils@gnu.org>

directory option (-d)
---------------------

This is the ``unpack into the directory dir'' option. This option takes a string argument dir. The input file names are relative to the current directory when the program was started.  This option tells unshar to insert a cd <dir> commad at the start of the shar text written to the shell.

overwrite option (-c)
---------------------

This is the ``overwrite any pre-existing files'' option. This option is passed through as an option to the shar file.  Many shell archive scripts accept a -c argument to indicate that existing files should be overwritten.

force option (-f)
-----------------

This is an alias for the overwrite option, see the overwrite option documentation.

split-at option (-E)
--------------------

This is the ``split input on SPLIT-MARK lines'' option. This option takes a string argument split-mark. With this option, unshar isolates each different shell archive from the others which have been placed in the same file, unpacking each in turn, from the beginning of the file to the end.  Its proper operation relies on the fact that many shar files are terminated by a readily identifiable string at the start of the last line.

For example, noticing that most `.signatures' have a double hyphen ("--") on a line right before them, one can then sometimes use --split-at=--.  The signature will then be skipped, along with the headers of the following message.

exit-0 option (-e)
------------------

This is the ``split input on "exit 0" lines'' option.

This option has some usage constraints.  It:

  * must not appear in combination with any of the following options: split-at.

Most shell archives end with a line consisting of simply "exit 0". This option is equivalent to (and conflicts with) --split-at="exit 0".

debug option (-D)
-----------------

This is the ``debug the shell code'' option. "set -x" will be emitted into the code the shell interprets.

presetting/configuring unshar
-----------------------------

Any option that is not marked as not presettable may be preset by loading values from configuration ("rc" or "ini") files.

libopts will search in $HOME for configuration (option) data. The environment variable HOME,  is expanded and replaced when the program runs If this is a plain file, it is simply processed. If it is a directory, then a file named .sharrc is searched for within that directory.

Configuration files may be in a wide variety of formats. The basic format is an option name followed by a value (argument) on the same line.  Values may be separated from the option name with a colon, equal sign or simply white space.  Values may be continued across multiple lines by escaping the newline with a backslash.

Multiple programs may also share the same initialization file. Common options are collected at the top, followed by program specific segments.  The segments are separated by lines like:

     [UNSHAR]

or by

     <?program unshar>

Do not mix these styles within one configuration file.

Compound values and carefully constructed string values may also be specified using XML syntax:

     <option-name>
        <sub-opt>...&lt;...&gt;...</sub-opt>
     </option-name>

yielding an option-name.sub-opt string value of

     "...<...>..."

AutoOpts does not track suboptions.  You simply note that it is a hierarchicly valued option.  AutoOpts does provide a means for searching the associated name/value pair list (see: optionFindValue).

The command line options relating to configuration and/or usage help are:

version (-v)
............

Print the program version to standard out, optionally with licensing information, then exit 0.  The optional argument specifies how much licensing detail to provide.  The default is to print the license name with the version.  The licensing infomation may be selected with an option argument. Only the first letter of the argument is examined:

version
     Only print the version.

copyright
     Name the copyright usage licensing terms.  This is the default.

verbose
     Print the full copyright usage licensing terms.

unshar exit status
------------------

One of the following exit values will be returned:

0 (EXIT_SUCCESS)
     Successful program execution.

1 (EXIT_FAILURE)
     There was an error in command usage.

2 (EXIT_POPEN_PROBLEM)
     cannot spawn or write to a shell process

3 (EXIT_CANNOT_CREATE)
     cannot create output file

4 (EXIT_BAD_DIRECTORY)
     the working directory structure is invalid

5 (EXIT_NOMEM)
     memory allocation failure

6 (EXIT_INVALID)
     invalid input, does not contain a shar file

66 (EX_NOINPUT)
     A specified configuration file could not be loaded.

70 (EX_SOFTWARE)
     libopts had an internal operational error.  Please report it to autogen-users@lists.sourceforge.net.  Thank you.

unshar Authors
--------------

The shar and unshar programs is the collective work of many authors.  Many people contributed by reporting problems, suggesting various improvements or submitting actual code.  A list of these people is in the THANKS file in the sharutils distribution.

unshar Bugs
-----------

Please put sharutils in the subject line for emailed bug reports.  It helps to spot the message.

unshar See Also
---------------

shar(1)