summaryrefslogtreecommitdiff
path: root/doc/shar.1
blob: a53effcdde8722bef383502cb1ca96d08990c282 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
.TH SHAR 1 "July 1, 2005"
.SH NAME
shar \- create shell archives
.SH SYNOPSIS
.nf
shar [ options ] file ...
shar \-S [ options ]
.fi
.SH DESCRIPTION
Shar
creates "shell archives" (or shar files) which are in text format
and can be mailed.  These files may be unpacked later by executing them
with /bin/sh.  The resulting archive is sent to standard out unless the
\f2\-o\f1 option is given.  A wide range of features provide extensive
flexibility in manufacturing shars and in specifying shar "smartness".
Archives may be "vanilla" or comprehensive.
.SH OPTIONS
.PP
Options have a one letter version starting with \- or a long version starting
with \-\-.  The exception is \f2\-\-help\f1, \f2\-\-version\f1,
\f2\-\-no-i18n\f1 and \f2\-\-print-text-domain-dir\f1 which does not
have short versions.
Mandatory arguments to long options are mandatory for short options too.
Options can be given in any order.  Some options depend on each other:
.nf
	The \f2\-o\f1 option is required if the \f2\-l\f1 or \f2\-L\f1 option is used.
	The \f2\-n\f1 option is required if the \f2\-a\f1 option is used.
	See \f2\-V\f1 below.
.fi
.SS "Giving feedback:"
.IP "\f2\-\-help\f1"
Print a help summary on standard output, then immediately exits.
.IP "\f2\-\-version\f1"
Print the version number of the program on standard output,
then immediately exits.
.IP "\f2\-q\f1 \f2\-\-quiet\f1 \f2\-\-silent\f1"
Do not output verbose messages locally when producing the archive.
.SS "Selecting files:"
.IP "\f2\-p\f1  \f2\-\-intermix-type\f1"
Allow positional parameter options.  The options \f2\-B\f1, \f2\-T\f1,
\f2-z\f1 and \f2\-Z\f1 may be embedded, and files to the right of the
option will be processed in the specified mode.
.IP "\f2\-S\f1  \f2\-\-stdin-file-list\f1"
Read list of files to be packed from the standard input rather
than from the command line.  Input must be in a form similar to
that generated by the find command, one filename per line.  This
switch is especially useful when the command line will not hold
the list of files to be packed.  For example:
.nf

find . \-type f \-print | \\
  sort | \\
  shar \-S \-Z \-L50 \-o /somewhere/big

.fi
If \f2\-p\f1 is specified on the command line, then the options
\f2\-B\f1, \f2\-T\f1, \f2\-z\f1 and \f2\-Z\f1 may be
included in the standard input (on a line separate from filenames).
The maximum number of lines of standard input, file names and
options, may not exceed 1024.
.SS "Splitting output:"
.IP "\f2\-o\f1 XXX  \f2\-\-output-prefix=\f1XXX"
Save the archive to files XXX.01 thru XXX.nn instead of sending it to
standard out.
Must be used when the \f2\-l\f1 or the \f2\-L\f1 switches are used.
.IP "\f2\-l\f1 XX  \f2\-\-whole-size-limit=\f1XX"
Limit the output file size to XXk bytes but don't split input files.
.IP "\f2\-L\f1 XX  \f2\-\-split-size-limit=\f1XX"
Limit output file size to XXk bytes and split files if necessary.  The archive
parts created with this option must be unpacked in correct order.
.SS "Controlling the shar headers:"
.IP "\f2\-n\f1 name  \f2\-\-archive-name=\f1name"
Name of archive to be included in the header of the shar files.
See the \f2\-a\f1 switch.
.IP "\f2\-s\f1 who@where  \f2\-\-submitter=\f1who@where"
Override automatically determined submitter name.
.IP "\f2\-a\f1  \f2\-\-net-headers\f1"
Allows automatic generation of headers:
.nf
	Submitted-by: who@where
	Archive-name: <name>/part##
.fi
The <name> must be given with the \f2\-n\f1 switch.
If name includes a '/' "/part" isn't used.  Thus:
.RS 10m
.nf
.ta 30n
\-n xyzzy	produces:
	xyzzy/part01
	xyzzy/part02

\-n xyzzy/patch	produces:
	xyzzy/patch01
	xyzzy/patch02

\-n xyzzy/patch01.	produces:
	xyzzy/patch01.01
	xyzzy/patch01.02
.RE
.fi
.IP ""
The who@where can be
explicitly stated with the \f2\-s\f1 switch if the default isn't appropriate.
Who@where is essentially built as `whoami`@`uname`.
.IP "\f2\-c\f1  \f2\-\-cut-mark\f1"
Start the shar with a cut line.  A line saying 'Cut here' is placed at the
start of each output file.
.IP "\f2\-t\f1  \f2\-\-translate\f1"
Translate messages in the script.  If you have set the \f2LANG\f1 environment
variable, messages printed by \f2shar\f1 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 \f2LANG\f1 environment
variable set when the script is produced.
.SS "Selecting how files are stocked:"
.IP "\f2\-M\f1  \f2\-\-mixed-uuencode\f1"
Mixed mode.  Determine if the files are text or binary and archive
correctly (default).  Files found to be binary are uudecoded prior to packing
(USE OF UUENCODE IS NOT APPRECIATED BY MANY ON THE NET).
.IP "\f2\-T\f1  \f2\-\-text-files\f1"
Treat all files as text.
.IP "\f2\-B\f1  \f2\-\-uuencode\f1"
Treat all files as binary, use uuencode prior to packing.  This increases the
size of the archive.  The recipient must have uudecode in order to unpack.
(USE OF UUENCODE IS NOT APPRECIATED BY MANY ON THE NET).
.IP "\f2\-z\f1  \f2\-\-gzip\f1"
Gzip and uuencode all files prior to packing.  The recipient must have
uudecode and gzip in order to unpack
(USE OF UUENCODE AND GZIP IS NOT APPRECIATED BY MANY ON THE NET).
.IP "\f2\-g\f1 LEVEL  \f2\-\-level-for-gzip=\f1LEVEL"
When doing compression, use '\-LEVEL' as a parameter to gzip.  Default is 9.
The \f2\-g\f1 option turns on the \f2\-z\f1 option by default.
.IP "\f2\-Z\f1  \f2\-\-compress\f1"
Compress and uuencode all files prior to packing.  The recipient must have
uudecode and compress in order to unpack
(USE OF UUENCODE AND COMPRESS IS NOT APPRECIATED BY MANY ON THE NET).
Option \f2\-C\f1 is synonymous to \f2\-Z\f1, but is being deprecated.
.IP "\f2\-b\f1 BITS  \f2\-\-bits-per-code=\f1BITS"
When doing compression, use '\-bBITS' as a parameter to compress.
The \f2\-B\f1 option turns on the \f2\-Z\f1 option by default.  Default value
is 12.
.SS "Protecting against transmission errors:"
.IP "\f2\-w\f1  \f2\-\-no-character-count\f1"
Do NOT check each file with 'wc \-c' after unpack.  The default is to check.
.IP "\f2\-D\f1  \f2\-\-no-md5-digest\f1"
Do NOT use 'md5sum' digest to verify the unpacked files. The default is to
check.
.IP "\f2\-F\f1  \f2\-\-force-prefix\f1"
Forces the prefix character (normally 'X' unless the parameter to the \f2\-d\f1
option starts with 'X') to be prepended to every line even if
not required.  This option may slightly increase the size of the archive,
especially if \f2\-B\f1 or \f2\-Z\f1 is used.
.IP "\f2\-d\f1 XXX  \f2\-\-here-delimiter=\f1XXX"
Use XXX to delimit the files in the shar instead of SHAR_EOF.
This is for those who want to personalize their shar files.
.SS "Producing different kinds of shars:"
.IP "\f2\-V\f1  \f2\-\-vanilla-operation\f1"
Produce "vanilla" shars which rely only upon the existence of sed and
echo in the unsharing environment.  In addition, "if test" must also
be supported unless the \f2\-x\f1 option is used.  The \f2\-V\f1 silently
disables options offensive to the "network cop" (or "brown shirt"),
but does warn you if it is specified with \f2\-B\f1, \f2-z\f1,
\f2\-Z\f1, \f2\-p\f1 or \f2\-M\f1 (any of which does or might
require uudecode, gzip or compress in the unsharing environment).
.IP "\f2\-P\f1  \f2\-\-no-piping\f1"
Use temporary files instead of pipes in the shar file.
.IP "\f2\-x\f1  \f2\-\-no-check-existing\f1"
Overwrite existing files without checking.
If neither \f2\-x\f1 nor \f2\-X\f1 is specified, the unpack will
check for and not overwrite existing files when unpacking the archive.
If \f2\-c\f1 is passed as a parameter to the script when unpacking:

.RS 10m
sh archive -c
.RE
.IP ""
then existing files will be overwritten unconditionally.
.IP "\f2\-X\f1  \f2\-\-query-user\f1"
When unpacking, interactively ask the user if files should be overwritten.
(DO NOT USE FOR SHARS SUBMITTED TO THE NET).
.IP "\f2\-m\f1  \f2\-\-no-timestamp\f1"
Avoid generating 'touch' commands to restore the file modification
dates when unpacking files from the archive.
.IP "\f2\-Q\f1  \f2\-\-quiet-unshar\f1"
Verbose OFF.  Disables the inclusion of comments to be output when the archive
is unpacked.
.IP "\f2\-f\f1  \f2\-\-basename\f1"
Restore by filename 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 \f2\-f\f1
is specified or not.
.SS "Internationalization:"
.IP "\f2\-\-no-i18n\f1"
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.
.IP "\f2\-\-print-text-domain-dir\f1"
Prints the directory shar looks in to find messages files for different
languages, then immediately exits.
.SH EXAMPLES
.nf
.ta 37n
shar *.c > cprog.shar	# all C prog sources
shar \-Q *.[ch] > cprog.shar	# non-verbose, .c and .h files
shar \-B \-l28 \-oarc.sh *.arc	# all binary .arc files, into
	# files arc.sh.01 thru arc.sh.NN
shar \-f /lcl/src/u*.c > u.sh	# use only the filenames
.ta
.fi
.SH WARNINGS
.PP
No chmod or touch is ever generated for directories created when unpacking.
Thus, if a directory is given to shar, the protection and
modification dates of corresponding unpacked directory
may not match those of the original.
.PP
If a directory is passed to shar, it may be scanned more than once.  Therefore,
one should be careful not change the directory while shar is running.
.PP
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 that directory).
.PP
Use of the \f2\-B\f1, \f2\-z\f1 or \f2\-Z\f1, and especially
\f2\-M\f1, may slow the archive process considerably, depending on
the number of files.
.PP
Use of \f2\-X\f1 produces shars which \f2WILL\f1 cause problems
with many unshar procedures.  Use this feature only for archives
to be passed among agreeable parties.  Certainly, \f2\-X\f1 is NOT
for shell archives which are to be submitted to Usenet.  Usage of
\f2\-B\f1, \f2\-z\f1 or \f2\-Z\f1 in net shars will cause you to
be flamed off the earth.  Not using \f2\-m\f1 or not using \f2\-F\f1
may also get you occasional complaints.
.SH SEE ALSO
.PP 
unshar(1)
.SH DIAGNOSTICS
.PP
Error messages for illegal or incompatible options,
for non-regular, missing or inaccessible files or for (unlikely)
memory allocation failure.
.SH 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.
.SH REPORTING BUGS
Report bugs to <bug-gnu-utils@gnu.org>.  Please put
.I sharutils
or
.I uuencode
in the subject line.  It helps to spot the message.