{
    "mode": "man",
    "parameter": "unshar",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/unshar/1/json",
    "generated": "2026-06-16T06:28:45Z",
    "synopsis": "unshar [-flags] [-flag [value]] [--option-name[[=| ]value]] [<file>...]\nThe  operands  that  this  program operates on may be specified either on the command line or\nread from standard input, one per line.  In that input, leading and trailing white  space  is\nstripped, blank lines are ignored.  Standard input may not be a terminal.",
    "sections": {
        "NAME": {
            "content": "unshar - unpack a shar archive\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "unshar [-flags] [-flag [value]] [--option-name[[=| ]value]] [<file>...]\n\nThe  operands  that  this  program operates on may be specified either on the command line or\nread from standard input, one per line.  In that input, leading and trailing white  space  is\nstripped, blank lines are ignored.  Standard input may not be a terminal.\n\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Unshar  scans the input files (typically email messages) looking for the start of a shell ar‐\nchive.  If no files are given, then standard input is processed instead.  It then passes each\narchive discovered through an invocation of the shell program to unpack it.\n\nThis program will perform its function for every file named on the command line or every file\nnamed in a list read from stdin.  The arguments or input names must  be  pre-existing  files.\nThe  input  list  may  contain  comments, which are blank lines or lines beginning with a '#'\ncharacter.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "-d --directory",
                    "content": "unpack into the directory dir.\n\nThe input file names are relative to  the  current  directory  when  the  program  was\nstarted.   This  option  tells  unshar to insert a cd <dir> commad at the start of the\nshar text written to the shell.\n",
                    "flag": "-d",
                    "long": "--directory"
                },
                {
                    "name": "-c --overwrite",
                    "content": "overwrite any pre-existing files.\n\nThis option is passed through as an option to  the  shar  file.   Many  shell  archive\nscripts accept a -c argument to indicate that existing files should be overwritten.\n",
                    "flag": "-c",
                    "long": "--overwrite"
                },
                {
                    "name": "-f --force",
                    "content": "This is an alias for the --overwrite option.\n",
                    "flag": "-f",
                    "long": "--force"
                },
                {
                    "name": "-E --split-at",
                    "content": "split input on split-mark lines.  The default split-mark for this option is:\nexit 0\n\nWith  this  option, unshar isolates each different shell archive from the others which\nhave been placed in the same file, unpacking each in turn, from the beginning  of  the\nfile  to  the  end.   Its proper operation relies on the fact that many shar files are\nterminated by a readily identifiable string at the start of the last line.\n\nFor example, noticing that most `.signatures' have a double hyphen (\"--\")  on  a  line\nright  before them, one can then sometimes use --split-at=--.  The signature will then\nbe skipped, along with the headers of the following message.\n",
                    "flag": "-E",
                    "long": "--split-at"
                },
                {
                    "name": "-e --exit-0",
                    "content": "split input on \"exit 0\" lines.  This option must not appear in combination with any of\nthe following options: split-at.\n\nMost  shell  archives  end  with a line consisting of simply \"exit 0\".  This option is\nequivalent to (and conflicts with) --split-at=\"exit 0\".\n",
                    "flag": "-e",
                    "long": "--exit-0"
                },
                {
                    "name": "-D --debug",
                    "content": "debug the shell code.\n\n\"set -x\" will be emitted into the code the shell interprets.\n",
                    "flag": "-D",
                    "long": "--debug"
                },
                {
                    "name": "-h --help",
                    "content": "Display usage information and exit.\n\n-!, --more-help\nPass the extended usage information through a pager.\n",
                    "flag": "-h",
                    "long": "--help"
                },
                {
                    "name": "-R --save-opts",
                    "content": "Save the option state to cfgfile.  The default is the last configuration  file  listed\nin the OPTION PRESETS section, below.  The command will exit after updating the config\nfile.\n",
                    "flag": "-R",
                    "long": "--save-opts"
                },
                {
                    "name": "-r --load-opts --no-load-opts",
                    "content": "Load options from cfgfile.  The no-load-opts form will disable the loading of  earlier\nconfig/rc/ini files.  --no-load-opts is handled early, out of order.\n",
                    "flag": "-r",
                    "long": "--no-load-opts"
                },
                {
                    "name": "-v --version",
                    "content": "Output  version  of program and exit.  The default mode is `v', a simple version.  The\n`c' mode will print copyright information and `n' will print the  full  copyright  no‐\ntice.\n",
                    "flag": "-v",
                    "long": "--version"
                }
            ]
        },
        "OPTION PRESETS": {
            "content": "Any option that is not marked as not presettable may be preset by loading values from config‐\nuration (\"RC\" or \".INI\") file(s).  The file \"$HOME/.sharrc\" will be used, if present.\n",
            "subsections": []
        },
        "FILES": {
            "content": "See OPTION PRESETS for configuration files.\n",
            "subsections": []
        },
        "EXIT STATUS": {
            "content": "One of the following exit values will be returned:\n\n0  (EXITSUCCESS)\nSuccessful program execution.\n\n1  (EXITFAILURE)\nThere was an error in command usage.\n\n2  (EXITPOPENPROBLEM)\ncannot spawn or write to a shell process\n\n3  (EXITCANNOTCREATE)\ncannot create output file\n\n4  (EXITBADDIRECTORY)\nthe working directory structure is invalid\n\n5  (EXITNOMEM)\nmemory allocation failure\n\n6  (EXITINVALID)\ninvalid input, does not contain a shar file\n\n66  (EXNOINPUT)\nA specified configuration file could not be loaded.\n\n70  (EXSOFTWARE)\nlibopts  had  an  internal  operational  error.   Please   report   it   to   autogen-\nusers@lists.sourceforge.net.  Thank you.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "shar(1)\n",
            "subsections": []
        },
        "AUTHORS": {
            "content": "The shar and unshar programs is the collective work of many authors.  Many people contributed\nby reporting problems, suggesting various improvements or submitting actual code.  A list  of\nthese people is in the THANKS file in the sharutils distribution.\n",
            "subsections": []
        },
        "COPYRIGHT": {
            "content": "Copyright  (C) 1994-2015 Free Software Foundation, Inc. all rights reserved.  This program is\nreleased under the terms of the GNU General Public License, version 3 or later.\n",
            "subsections": []
        },
        "BUGS": {
            "content": "Please put sharutils in the subject line for emailed bug reports.  It helps to spot the  mes‐\nsage.\n\nPlease send bug reports to: bug-gnu-utils@gnu.org\n",
            "subsections": []
        },
        "NOTES": {
            "content": "This manual page was AutoGen-erated from the unshar option definitions.\n\n\n\nGNU sharutils (4.15.2)                       30 May 2015                                   unshar(1)",
            "subsections": []
        }
    },
    "summary": "unshar - unpack a shar archive",
    "flags": [
        {
            "flag": "-d",
            "long": "--directory",
            "arg": null,
            "description": "unpack into the directory 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."
        },
        {
            "flag": "-c",
            "long": "--overwrite",
            "arg": null,
            "description": "overwrite any pre-existing files. 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."
        },
        {
            "flag": "-f",
            "long": "--force",
            "arg": null,
            "description": "This is an alias for the --overwrite option."
        },
        {
            "flag": "-E",
            "long": "--split-at",
            "arg": null,
            "description": "split input on split-mark lines. The default split-mark for this option is: exit 0 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."
        },
        {
            "flag": "-e",
            "long": "--exit-0",
            "arg": null,
            "description": "split input on \"exit 0\" lines. This option 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\"."
        },
        {
            "flag": "-D",
            "long": "--debug",
            "arg": null,
            "description": "debug the shell code. \"set -x\" will be emitted into the code the shell interprets."
        },
        {
            "flag": "-h",
            "long": "--help",
            "arg": null,
            "description": "Display usage information and exit. -!, --more-help Pass the extended usage information through a pager."
        },
        {
            "flag": "-R",
            "long": "--save-opts",
            "arg": null,
            "description": "Save the option state to cfgfile. The default is the last configuration file listed in the OPTION PRESETS section, below. The command will exit after updating the config file."
        },
        {
            "flag": "-r",
            "long": "--no-load-opts",
            "arg": null,
            "description": "Load options from cfgfile. The no-load-opts form will disable the loading of earlier config/rc/ini files. --no-load-opts is handled early, out of order."
        },
        {
            "flag": "-v",
            "long": "--version",
            "arg": null,
            "description": "Output version of program and exit. The default mode is `v', a simple version. The `c' mode will print copyright information and `n' will print the full copyright no‐ tice."
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "shar",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/shar/1/json"
        }
    ]
}