.de1 NOP . it 1 an-trap . if \\n[.$] \,\\$*\/ .. .ie t \ .ds B-Font [CB] .ds I-Font [CI] .ds R-Font [CR] .el \ .ds B-Font B .ds I-Font I .ds R-Font R .TH shar 1 "30 May 2015" "GNU sharutils (4.15.2)" "User Commands" .\" .\" DO NOT EDIT THIS FILE (in-mem file) .\" .\" It has been AutoGen-ed .\" From the definitions shar-opts.def .\" and the template file agman-cmd.tpl .SH NAME \f\*[B-Font]shar\fP \- create a shell archive .SH SYNOPSIS \f\*[B-Font]shar\fP .\" Mixture of short (flag) options and long options [\f\*[B-Font]\-flags\f[]] [\f\*[B-Font]\-flag\f[] [\f\*[I-Font]value\f[]]] [\f\*[B-Font]\-\-option-name\f[][[=| ]\f\*[I-Font]value\f[]]] [...] .sp \n(Ppu .ne 2 If no \fIfile\fPs are specified, the list of input files is read from standard input. Standard input must not be a terminal. .SH "DESCRIPTION" \fBshar\fP creates "shell archives" (or shar files) which are in text format and can be emailed. These files may be unpacked later by executing them with \fI/bin/sh\fP. The resulting archive is sent to standard out unless the \fB-o\fP option is given. A wide range of features provide extensive flexibility in manufacturing shars and in specifying \fBshar\fP "smartness". Archives may be fairly simple (\fB--vanilla-operation\fP) or essentially a mailable \fBtar\fP archive. .sp Options may be specified in any order until a \fBfile\fP argument is recognized. If the \fB--intermix-type\fP option has been specified, more compression and encoding options will be recognized between the \fIfile\fP arguments. .sp Though this program supports \fBuuencode\fP-d files, they are deprecated. If you are emailing files, please consider mime-encoded files. If you do \fBuuencode\fP, base64 is the preferred encoding method. .SH "OPTIONS" .SS "Specifying compression" .TP .NOP \f\*[B-Font]\-p\f[], \f\*[B-Font]\-\-intermix\-type\f[] specify compression for input files. This option must not appear in combination with any of the following options: vanilla-operation. .sp Allow positional parameter options. The compression method and encoding method options may be intermixed with file names. Files named after these options will be processed in the specified way. .TP .NOP \f\*[B-Font]\-C\f[] \f\*[I-Font]program\f[], \f\*[B-Font]\-\-compactor\f[]=\f\*[I-Font]program\f[] specify compaction (compression) program. This option may appear an unlimited number of times. This option must not appear in combination with any of the following options: vanilla-operation. .sp The \fBgzip\fP, \fBbzip2\fP and \fBcompress\fP compactor commands may be specified by the program name as the option name, e.g. \fB--gzip\fP. Those options, however, are being deprecated. There is also the \fBxz\fP compactor now. Specify \fBxz\fP with \fB-C xz\fP or \fB--compactor=xz\fP. .sp Specifying the compactor "\fBnone\fP" will disable file compression. Compressed files are never processed as plain text. They are always uuencoded and the recipient must have \fBuudecode\fP to unpack them. .sp Specifying the compactor \fBcompress\fP is deprecated. .TP .NOP \f\*[B-Font]\-g\f[] \f\*[I-Font]level\f[], \f\*[B-Font]\-\-level\-of\-compression\f[]=\f\*[I-Font]level\f[] pass \fILEVEL\fP for compression. This option takes an integer number as its argument. The value of \f\*[I-Font]level\f[] is constrained to being: .in +4 .nf .na in the range 1 through 9 .fi .in -4 The default \f\*[I-Font]level\f[] for this option is: .ti +4 9 .sp Some compression programs allow for a level of compression. The default is \fB9\fP, but this option allows you to specify something else. This value is used by \fBgzip\fP, \fBbzip2\fP and \fBxz\fP, but not \fBcompress\fP. .TP .NOP \f\*[B-Font]\-j\f[], \f\*[B-Font]\-\-bzip2\f[] \fBbzip2\fP and \fBuuencode\fP files. This option may appear an unlimited number of times. .sp \fBbzip2\fP compress and \fBuuencode\fP all files prior to packing. The recipient must have \fBuudecode\fP \fBbzip2\fP in order to unpack. .sp .B NOTE: THIS OPTION IS DEPRECATED .TP .NOP \f\*[B-Font]\-z\f[], \f\*[B-Font]\-\-gzip\f[] \fBgzip\fP and \fBuuencode\fP files. This option may appear an unlimited number of times. .sp \fBgzip\fP compress and \fBuuencode\fP all files prior to packing. The recipient must have \fBuudecode\fP and \fBgzip\fP in order to unpack. .sp .B NOTE: THIS OPTION IS DEPRECATED .TP .NOP \f\*[B-Font]\-Z\f[], \f\*[B-Font]\-\-compress\f[] \fBcompress\fP and \fBuuencode\fP files. This option may appear an unlimited number of times. .sp \fBcompress\fP and \fBuuencode\fP all files prior to packing. The recipient must have \fBuudecode\fP and \fBcompress\fP in order to unpack. .sp .B NOTE: THIS OPTION IS DEPRECATED .TP .NOP \f\*[B-Font]\-\-level-for-gzip\f[] This is an alias for the \fI--level-of-compression\fR option. .sp .B NOTE: THIS OPTION IS DEPRECATED .TP .NOP \f\*[B-Font]\-b\f[] \f\*[I-Font]bits\f[], \f\*[B-Font]\-\-bits\-per\-code\f[]=\f\*[I-Font]bits\f[] pass \fIbits\fP (default 12) to compress. The default \f\*[I-Font]bits\f[] for this option is: .ti +4 12 .sp This is the compression factor used by the \fBcompress\fP program. .sp .B NOTE: THIS OPTION IS DEPRECATED .SS "Specifying file encoding methodology" Files may be stored in the shar either as plain text or uuencoded. By default, the program selects which by examining the file. You may force the selection for all files. In intermixed option/file mode, this setting may be changed during processing. .TP .NOP \f\*[B-Font]\-M\f[], \f\*[B-Font]\-\-mixed\-uuencode\f[] decide uuencoding for each file. This option is a member of the mixed-uuencode class of options. .sp Automatically determine if the files are text or binary and archive correctly. Files found to be binary are uuencoded prior to packing. This is the default behavior for \fBshar\fP. .sp For a file to be considered a text file instead of a binary file, all the following should be true: .sp 1 The file does not contain any ASCII control character besides \fIBS\fP (backspace), \fIHT\fP (horizontal tab), \fILF\fP (new line) or \fIFF\fP (form feed). .sp 1 The file contains no character with its eighth-bit set. .sp 1 The file contains no line beginning with the five letters "\fBfrom \fP", capitalized or not. (Mail handling programs will often gratuitously insert a \fB>\fP character before it.) .sp 1 The file is either empty or ends with a \fILF\fP (newline) byte. .sp 1 No line in the file contains more than 200 characters. For counting purpose, lines are separated by a \fILF\fP (newline). .br .TP .NOP \f\*[B-Font]\-B\f[], \f\*[B-Font]\-\-uuencode\f[] treat all files as binary. This option is a member of the mixed-uuencode class of options. .sp Use \fBuuencode\fP prior to packing all files. This increases the size of the archive. The recipient must have \fBuudecode\fP in order to unpack. Compressed files are always encoded. .TP .NOP \f\*[B-Font]\-T\f[], \f\*[B-Font]\-\-text\-files\f[] treat all files as text. This option is a member of the mixed-uuencode class of options. .sp If you have files with non-ascii bytes or text that some mail handling programs do not like, you may find difficulties. However, if you are using FTP or SSH/SCP, the non-conforming text files should be okay. .SS "Specifying file selection and output modes" .TP .NOP \f\*[B-Font]\-o\f[] \f\*[I-Font]prefix\f[], \f\*[B-Font]\-\-output\-prefix\f[]=\f\*[I-Font]prefix\f[] print output to file PREFIX.nn. .sp Save the archive to files \fIprefix.01\fP thru \fIprefix.nn\fP instead of sending all output to standard out. Must be specified when the \fB--whole-size-limit\fP or \fB--split-size-limit\fP options are specified. .sp When \fBprefix\fP contains a \fB%\fP character, \fBprefix\fP is then interpreted as a \fBsprintf\fP format, which should be able to display a single decimal number. When \fBprefix\fP does not contain such a \fB%\fP character, the string \fB.%02d\fP is internally appended. .TP .NOP \f\*[B-Font]\-l\f[] \f\*[I-Font]size\f[], \f\*[B-Font]\-\-whole\-size\-limit\f[]=\f\*[I-Font]size\f[] split archive, not files, to \fIsize\fP. This option is a member of the whole-size-limit class of options. This option must appear in combination with the following options: output-prefix. This option takes an integer number as its argument. The value of \f\*[I-Font]size\f[] is constrained to being: .in +4 .nf .na in the range 8 through 1023, or in the range 8192 through 4194304 .fi .in -4 .sp Limit the output file size to \fIsize\fP bytes, but don't split input files. If \fIsize\fP is less than 1024, then it will be multiplied by 1024. The value may also be specified with a k, K, m or M suffix. The number is then multiplied by 1000, 1024, 1000000, or 1048576, respectively. 4M (4194304) is the maximum allowed. .sp Unlike the \fBsplit-size-limit\fP option, this allows the recipient of the shar files to unpack them in any order. .TP .NOP \f\*[B-Font]\-L\f[] \f\*[I-Font]size\f[], \f\*[B-Font]\-\-split\-size\-limit\f[]=\f\*[I-Font]size\f[] split archive or files to \fIsize\fP. This option is a member of the whole-size-limit class of options. This option must appear in combination with the following options: output-prefix. This option takes an integer number as its argument. The value of \f\*[I-Font]size\f[] is constrained to being: .in +4 .nf .na in the range 8 through 1023, or in the range 8192 through 4194304 .fi .in -4 .sp Limit output file size to \fIsize\fP bytes, splitting files if necessary. The allowed values are specified as with the \fB--whole-size-limit\fP option. .sp The archive parts created with this option must be unpacked in the correct order. If the recipient of the shell archives wants to put all of them in a single email folder (file), they will have to be saved in the correct order for \fBunshar\fP to unpack them all at once (using one of the split archive options). see: unshar Invocation. .TP .NOP \f\*[B-Font]\-I\f[] \f\*[I-Font]file\f[], \f\*[B-Font]\-\-input\-file\-list\f[]=\f\*[I-Font]file\f[] read file list from a file. .sp This option causes \fIfile\fP to be reopened as standard input. If no files are found on the input line, then standard input is read for input file names. Use of this option will prohibit input files from being listed on the command line. .sp Input must be in a form similar to that generated by \fBfind\fP, one filename per line. This switch is especially useful when the command line will not hold the list of files to be archived. .sp If the \fB--intermix-type\fP option is specified on the command line, then the compression options may be included in the standard input on lines by themselves and no file name may begin with a hyphen. .sp For example: .nf { echo \--compact xz find . \-type f \-print | sort } | shar \-S \-p \-L50K \-o /somewhere/big .fi .TP .NOP \f\*[B-Font]\-S\f[], \f\*[B-Font]\-\-stdin\-file\-list\f[] read file list from standard input. .sp This option is actually a no-op. It is a wrapper for \fB--input-file-list=-\fP. .sp .B NOTE: THIS OPTION IS DEPRECATED .SS "Controlling the shar headers" .TP .NOP \f\*[B-Font]\-n\f[] \f\*[I-Font]name\f[], \f\*[B-Font]\-\-archive\-name\f[]=\f\*[I-Font]name\f[] use \fIname\fP to document the archive. .sp Name of archive to be included in the subject header of the shar files. See the \fB--net-headers\fP option. .TP .NOP \f\*[B-Font]\-s\f[] \f\*[I-Font]who@where\f[], \f\*[B-Font]\-\-submitter\f[]=\f\*[I-Font]who@where\f[] override the submitter name. .sp \fBshar\fP will normally determine the submitter name by querying the system. Use this option if it is being done on behalf of another. .TP .NOP \f\*[B-Font]\-a\f[], \f\*[B-Font]\-\-net\-headers\f[] output Submitted-by: & Archive-name: headers. This option must appear in combination with the following options: archive-name. .sp Adds specialized email headers: .nf Submitted-by: \fIwho@@where\fP Archive-name: \fIname\fP/part## .fi The \fIwho@@where\fP is normally derived, but can be specified with the \fB--submitter\fP option. The \fIname\fP must be provided with the \fB--archive-name\fP option. If the archive name includes a slash (\fB/\fP) character, then the \fB/part##\fP is omitted. Thus \fB-n xyzzy\fP produces: .nf xyzzy/part01 xyzzy/part02 .fi .sp while \fB-n xyzzy/patch\fP produces: .nf xyzzy/patch01 xyzzy/patch02 .fi .sp and \fB-n xyzzy/patch01.\fP produces: .nf xyzzy/patch01.01 xyzzy/patch01.02 .fi .TP .NOP \f\*[B-Font]\-c\f[], \f\*[B-Font]\-\-cut\-mark\f[] start the shar with a cut line. .sp A line saying 'Cut here' is placed at the start of each output file. .TP .NOP \f\*[B-Font]\-t\f[], \f\*[B-Font]\-\-translate\f[] translate messages in the script. .sp Translate messages in the script. If you have set the \fBLANG\fP environment variable, messages printed by \fBshar\fP will be in the specified language. The produced script will still be emitted using messages in the lingua franca of the computer world: English. This option will cause the script messages to appear in the languages specified by the \fBLANG\fP environment variable set when the script is produced. .SS "Protecting against transmission issues" .TP .NOP \f\*[B-Font]\-\-no\-character\-count\f[] do not use `wc \-c' to check size. .sp Do NOT check each file with 'wc \-c' after unpack. The default is to check. .TP .NOP \f\*[B-Font]\-D\f[], \f\*[B-Font]\-\-no\-md5\-digest\f[] do not use \fBmd5sum\fP digest to verify. .sp Do \fInot\fP use \fBmd5sum\fP digest to verify the unpacked files. The default is to check. .TP .NOP \f\*[B-Font]\-F\f[], \f\*[B-Font]\-\-force\-prefix\f[] apply the prefix character on every line. .sp Forces the prefix character to be prepended to every line, even if not required. This option may slightly increase the size of the archive, especially if \fB--uuencode\fP or a compression option is used. .TP .NOP \f\*[B-Font]\-d\f[] \f\*[I-Font]delim\f[], \f\*[B-Font]\-\-here\-delimiter\f[]=\f\*[I-Font]delim\f[] use \fIdelim\fP to delimit the files. The default \f\*[I-Font]delim\f[] for this option is: .ti +4 SHAR_EOF .sp Use DELIM to delimit the files in the shar instead of SHAR_EOF. This is for those who want to personalize their shar files. The delimiter will always be prefixed and suffixed with underscores. .SS "Producing different kinds of shars" .TP .NOP \f\*[B-Font]\-V\f[], \f\*[B-Font]\-\-vanilla\-operation\f[] produce very simple shars. .sp This option produces \fBvanilla\fP shars which rely only upon the existence of \fBecho\fP, \fBtest\fP and \fBsed\fP in the unpacking environment. .sp It changes the default behavior from mixed mode (\fB--mixed-uuencode\fP) to text mode (\fB--text-files\fP). Warnings are produced if options are specified that will require decompression or decoding in the unpacking environment. .TP .NOP \f\*[B-Font]\-P\f[], \f\*[B-Font]\-\-no\-piping\f[] use temporary files between programs. .sp In the \fIshar\fP file, use a temporary file to hold file contents between unpacking stages instead of using pipes. This option is mandatory when you know the unpacking will happen on systems that do not support pipes. .TP .NOP \f\*[B-Font]\-x\f[], \f\*[B-Font]\-\-no\-check\-existing\f[] blindly overwrite existing files. .sp Create the archive so that when processed it will overwrite existing files without checking first. If neither this option nor the \fB--query-user\fP option is specified, the unpack will not overwrite pre-existing files. In all cases, however, if \fB--cut-mark\fP is passed as a parameter to the script when unpacking, then existing files will be overwritten unconditionally. .sp .nf sh shar-archive-file \-c .fi .TP .NOP \f\*[B-Font]\-X\f[], \f\*[B-Font]\-\-query\-user\f[] ask user before overwriting files. This option must not appear in combination with any of the following options: vanilla-operation. .sp When unpacking, interactively ask the user if files should be overwritten. Do not use for shars submitted to the net. .sp Use of this option produces shars which \fIwill\fP cause problems with some unshar-style procedures, particularly when used together with vanilla mode (\fB--vanilla-operation\fP). Use this feature mainly for archives to be passed among agreeable parties. Certainly, \fB-X\fP is \fInot\fP for shell archives which are to be submitted to Usenet or other public networks. .sp The problem is that \fBunshar\fP programs or procedures often feed \fI/bin/sh\fP from its standard input, thus putting \fI/bin/sh\fP and the shell archive script in competition for input lines. As an attempt to alleviate this problem, \fBshar\fP will try to detect if \fI/dev/tty\fP exists at the receiving site and will use it to read user replies. But this does not work in all cases, it may happen that the receiving user will have to avoid using \fBunshar\fP programs or procedures, and call \fI/bin/sh\fP directly. In vanilla mode, using \fI/dev/tty\fP is not even attempted. .TP .NOP \f\*[B-Font]\-m\f[], \f\*[B-Font]\-\-no\-timestamp\f[] do not restore modification times. .sp Avoid generating 'touch' commands to restore the file modification dates when unpacking files from the archive. .sp When file modification times are not preserved, project build programs like "make" will see built files older than the files they get built from. This is why, when this option is not used, a special effort is made to restore timestamps. .TP .NOP \f\*[B-Font]\-Q\f[], \f\*[B-Font]\-\-quiet\-unshar\f[] avoid verbose messages at unshar time. .sp Verbose OFF. Disables the inclusion of comments to be output when the archive is unpacked. .TP .NOP \f\*[B-Font]\-f\f[], \f\*[B-Font]\-\-basename\f[] restore in one directory, despite hierarchy. .sp Restore by the base file name only, rather than path. This option causes only file names to be used, which is useful when building a shar from several directories, or another directory. Note that if a directory name is passed to shar, the substructure of that directory will be restored whether this option is specified or not. .SS "Internationalization options" .TP .NOP \f\*[B-Font]\-\-no\-i18n\f[] do not internationalize. .sp Do not produce internationalized shell archives, use default English messages. By default, shar produces archives that will try to output messages in the unpackers preferred language (as determined by the LANG/LC_MESSAGES environmental variables) when they are unpacked. If no message file for the unpackers language is found at unpack time, messages will be in English. .TP .NOP \f\*[B-Font]\-\-print\-text\-domain\-dir\f[] print directory with shar messages. .sp Prints the directory shar looks in to find messages files for different languages, then immediately exits. .SS "User feedback/entertainment" .TP .NOP \f\*[B-Font]\-q\f[], \f\*[B-Font]\-\-quiet\f[] do not output verbose messages. .sp omit progress messages. .TP .NOP \f\*[B-Font]\-\-silent\f[] This is an alias for the \fI--quiet\fR option. .TP .NOP \f\*[B-Font]\-h\f[], \f\*[B-Font]\-\-help\f[] Display usage information and exit. .TP .NOP \f\*[B-Font]\-\&!\f[], \f\*[B-Font]\-\-more-help\f[] Pass the extended usage information through a pager. .TP .NOP \f\*[B-Font]\-R\f[] [\f\*[I-Font]cfgfile\f[]], \f\*[B-Font]\-\-save-opts\f[] [=\f\*[I-Font]cfgfile\f[]] Save the option state to \fIcfgfile\fP. The default is the \fIlast\fP configuration file listed in the \fBOPTION PRESETS\fP section, below. The command will exit after updating the config file. .TP .NOP \f\*[B-Font]\-r\f[] \f\*[I-Font]cfgfile\f[], \f\*[B-Font]\-\-load-opts\f[]=\f\*[I-Font]cfgfile\f[], \f\*[B-Font]\-\-no-load-opts\f[] Load options from \fIcfgfile\fP. The \fIno-load-opts\fP form will disable the loading of earlier config/rc/ini files. \fI\-\-no-load-opts\fP is handled early, out of order. .TP .NOP \f\*[B-Font]\-v\f[] [{\f\*[I-Font]v|c|n\f[] \f\*[B-Font]\-\-version\f[] [{\f\*[I-Font]v|c|n\f[]}]}] 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 notice. .PP .SH "OPTION PRESETS" Any option that is not marked as \fInot presettable\fP may be preset by loading values from configuration ("RC" or ".INI") file(s). The file "\fI$HOME/.sharrc\fP" will be used, if present. .SH WARNINGS No attempt is made to restore the protection and modification dates for directories, even if this is done by default for files. Thus, if a directory is given to \fBshar\fP, the protection and modification dates of corresponding unpacked directory may not match those of the original. .sp If a directory is passed to shar, it may be scanned more than once, to conserve memory. Therefore, do not change the directory contents while shar is running. .sp Be careful that the output file(s) are not included in the inputs or shar may loop until the disk fills up. Be particularly careful when a directory is passed to shar that the output files are not in that directory or a subdirectory of it. .sp Use of the compression and encoding options will slow the archive process, perhaps considerably. .sp Use of the \fB\-\-query\-user\fP produces shars which \fIwill\fP cause problems with many unshar procedures. Use this feature only for archives to be passed among agreeable parties. Certainly, \fBquery\-user\fP is NOT for shell archives which are to be distributed across the net. The use of compression in net shars will cause you to be flamed off the earth. Not using the \fB\-\-no\-timestamp\fP or \fB\-\-force\-prefix\fP options may also get you occasional complaints. Put these options into your \fI~/.sharrc\fP file. .SH "FILES" See \fBOPTION PRESETS\fP for configuration files. .SH EXAMPLES The first shows how to make a shell archive out of all C program sources. The second produces a shell archive with all \fI.c\fP and \fI.h\fP files, which unpacks silently. The third gives a shell archive of all uuencoded \fI.arc\fP files, into numbered files starting from \fIarc.sh.01\fP. The last example gives a shell archive which will use only the file names at unpack time. .sp .br .in +4 .nf shar *.c > cprog.shar shar \-Q *.[ch] > cprog.shar shar \-B \-l28 \-oarc.sh *.arc shar \-f /lcl/src/u*.c > u.sh .in -4 .fi .SH "EXIT STATUS" One of the following exit values will be returned: .TP .NOP 0 " (EXIT_SUCCESS)" Successful program execution. .TP .NOP 1 " (EXIT_OPTION_ERROR)" The command options were misconfigured. .TP .NOP 2 " (EXIT_FILE_NOT_FOUND)" a specified input could not be found .TP .NOP 3 " (EXIT_CANNOT_OPENDIR)" open/close of specified directory failed .TP .NOP 4 " (EXIT_FAILED)" Resource limit/miscelleaneous shar command failure .TP .NOP 63 " (EXIT_BUG)" There is a shar command bug. Please report it. .TP .NOP 66 " (EX_NOINPUT)" A specified configuration file could not be loaded. .TP .NOP 70 " (EX_SOFTWARE)" libopts had an internal operational error. Please report it to autogen-users@lists.sourceforge.net. Thank you. .PP .SH "SEE ALSO" unshar(1) .SH AUTHORS The \fIshar\fP and \fIunshar\fP 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 \fITHANKS\fP file in the sharutils distribution. .SH "COPYRIGHT" Copyright (C) 1994-2015 Free Software Foundation, Inc. all rights reserved. This program is released under the terms of the GNU General Public License, version 3 or later. .SH BUGS Please put \fBsharutils\fP in the subject line for emailed bug reports. It helps to spot the message. .sp \n(Ppu .ne 2 Please send bug reports to: bug-gnu-utils@gnu.org .SH "NOTES" This manual page was \fIAutoGen\fP-erated from the \fBshar\fP option definitions.