-
Notifications
You must be signed in to change notification settings - Fork 12
/
sh6.1
804 lines (802 loc) · 22.5 KB
/
sh6.1
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
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
.\"
.\" Copyright (c) 2003-2011
.\" Jeffrey Allen Neitzel <jan (at) v6shell (dot) org>.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JEFFREY ALLEN NEITZEL ``AS IS'', AND ANY
.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
.\" DISCLAIMED. IN NO EVENT SHALL JEFFREY ALLEN NEITZEL BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
.\" USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" @(#)$Id$
.\"
.\" Derived from: Sixth Edition UNIX /usr/man/man1/sh.1
.\"
.\" Copyright (C) Caldera International Inc. 2001-2002. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code and documentation must retain the above
.\" copyright notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed or owned by Caldera
.\" International, Inc.
.\" 4. Neither the name of Caldera International, Inc. nor the names of other
.\" contributors may be used to endorse or promote products derived from
.\" this software without specific prior written permission.
.\"
.\" USE OF THE SOFTWARE PROVIDED FOR UNDER THIS LICENSE BY CALDERA
.\" INTERNATIONAL, INC. AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
.\" IN NO EVENT SHALL CALDERA INTERNATIONAL, INC. BE LIABLE FOR ANY DIRECT,
.\" INDIRECT INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
.\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.TH SH6 1 "@OSH_DATE@" "@OSH_VERSION@" "General Commands"
.SH NAME
sh6 \- shell (command interpreter)
.SH SYNOPSIS
.B sh6
[\fB\-\fR |
\fB\-c\fR [\fIstring\fR] |
\fB\-t\fR |
\fIfile\fR [\fIarg1 ...\fR]]
.SH DESCRIPTION
.I Sh6
is a port of the
standard command interpreter from Sixth Edition UNIX.
It may be used either as an interactive shell
or as a non-interactive shell.
Throughout this manual,
`(+)' indicates those cases where
.I sh6
is known to differ from the original
.IR sh (1),
as it appeared in Sixth Edition UNIX.
.PP
The options are as follows:
.TP
.B \-
The shell reads and executes command lines
from the standard input until
end-of-file or
.BR exit .
.TP
\fB\-c\fR [\fIstring\fR]
If a
.I string
is specified,
the shell executes it
as a command line and exits.
Otherwise,
the shell treats it as the
.B \-
option.
.TP
.B \-t
The shell reads a single line from the standard input,
executes it as a command line,
and exits.
.PP
The shell may also be invoked non-interactively
to read, interpret, and execute an ASCII command file.
The specified
.I file
and any arguments
are treated as positional parameters
(see
.I "Parameter substitution"
below)
during execution of the command file.
.PP
Otherwise,
if no arguments are specified and if both
the standard input and standard error are
connected to a terminal,
the shell is interactive.
An interactive shell prompts the user
with a `%\ ' (or `#\ ' for the superuser)
before reading each command line from the terminal.
.SS Commands
Each command is a sequence of non-blank command arguments
separated by blanks (spaces or tabs).
The first argument specifies the name of a command to be executed.
Except for certain types of special arguments described below,
the arguments other than the command name are passed
without interpretation to the invoked command.
.PP
If the first argument names a special command,
the shell executes it (see
.I "Special commands"
below).
Otherwise,
the shell treats it as an external command,
which is located as follows.
.PP
(+) If the command name contains no `/' characters,
the sequence of directories in the environment variable PATH
is searched for the first occurrence
of an executable file by that name,
which the shell attempts to execute.
However,
if the command name contains one or more `/' characters,
the shell attempts to execute it without
performing any PATH search.
.PP
(+) If an executable file does not begin with
the proper magic number or a `#!shell' sequence,
it is assumed to be an ASCII command file,
and a new shell is automatically invoked to execute it.
The environment variable EXECSHELL
specifies the shell which is invoked
to execute such a file.
.PP
If a command cannot be found or executed,
a diagnostic is printed.
.SS Command lines
Commands separated by `|' or `^' constitute a chain of
.IR filters ,
or a
.IR pipeline .
The standard output of each command but the last
is taken as the standard input of the next command.
Each command is run as a separate process, connected
by pipes (see
.IR pipe (2))
to its neighbors.
.PP
A
.IR "command line" ,
or
.IR list ,
consists of one or more pipelines separated,
and perhaps terminated by `;' or `&'.
The semicolon designates sequential execution.
The ampersand designates asynchronous execution,
which causes the preceding pipeline to be executed
without waiting for it to finish.
The process ID of each command in such a pipeline is reported,
so that it may be used if necessary for a subsequent
.IR kill (1).
.PP
A list contained within parentheses such as `(\ list\ )'
is executed in a subshell and may appear
in place of a simple command as a filter.
.PP
If a command line is syntactically incorrect,
a diagnostic is printed.
.SS Termination reporting
All terminations other than exit and interrupt
are considered to be abnormal.
If a sequential process terminates abnormally,
a message is printed.
The termination report for an asynchronous process
is given upon execution of the first
sequential command subsequent to its termination,
or when the
.B wait
special command is executed.
The following is a list of the possible
termination messages:
.PP
.nf
Hangup
Quit
Illegal instruction
Trace/BPT trap
IOT trap
EMT trap
Floating exception
Killed
Bus error
Memory fault
Bad system call
.fi
.PP
For an asynchronous process,
its process ID is prepended to the appropriate message.
If a core image is produced,
`\ \-\-\ Core\ dumped' is appended
to the appropriate message.
.SS I/O redirection
Each of the following argument forms
is interpreted as a
.I redirection
by the shell itself.
Such a redirection may appear anywhere among
the arguments of a simple command,
or before or after a parenthesized command list,
and is associated with that command or command list.
.PP
A redirection of the form `<arg' causes the file `arg'
to be used as the standard input (file descriptor 0)
for the associated command.
.PP
A redirection of the form `>arg' causes the file `arg'
to be used as the standard output (file descriptor 1)
for the associated command.
If `arg' does not already exist, it is created;
otherwise, it is truncated at the outset.
.PP
A redirection of the form `>>arg' is the same as `>arg',
except if `arg' already exists the command output is
always appended to the end of the file.
.PP
For example, either of the following command lines:
.PP
.nf
% date >.dirlist ; pwd >>.dirlist ; ls \-l >>.dirlist
% ( date ; pwd ; ls \-l ) >.dirlist
.fi
.PP
creates on the file `.dirlist',
the current date and time,
followed by the name and a long listing
of the current working directory.
.PP
A `>arg' or `>>arg' redirection associated with any
but the last command of a pipeline is ineffectual,
as is a `<arg' redirection with any but the first.
.PP
The standard error (file descriptor 2)
is never subject to redirection by the shell itself.
Thus,
commands may write diagnostics to a location
where they have a chance to be seen.
However,
.IR fd2 (1)
provides a way to redirect the diagnostic output
to another location.
.PP
If the file for a redirection cannot be opened or created,
a diagnostic is printed.
.SS Quoting
The shell treats all
.I quoted
characters literally.
This includes characters which may have
special meaning to the shell such as
`|', `^', `;', `&', `<', `>', and others
described in this manual.
If such characters are quoted,
they represent themselves and may be passed
as part of arguments.
.PP
An individual
.I backslash
(\\) quotes,
or
.IR escapes ,
the next individual character.
A backslash followed by a newline is a special case
which allows continuation of command-line input
onto the next line.
Each backslash-newline sequence in the input
is translated into a blank.
.PP
Individual characters, and sequences of characters,
are also quoted when enclosed by a matched pair of
.I double
(") or
.I single
(') quotes.
For example:
.PP
.nf
% awk '{ print NR "\\t" $0 }' README ^ more
.fi
.PP
causes
.IR awk (1)
to write each line in `README',
preceded by its line number and a tab,
to the standard output which is piped to
.IR more (1)
for viewing.
The quotes prevent the shell from trying
to interpret any part of the string,
which is then passed as a single argument to awk.
.PP
If a double or single quote appears
but is not part of a matched pair,
a diagnostic is printed.
.SS Parameter substitution
When the shell is invoked as a non-interactive command,
it has additional string processing capabilities
which are not available when it is interactive.
A non-interactive shell may be invoked
as follows:
.PP
.nf
\fBsh6\fR \fIname\fR [\fIarg1 ...\fR]
.fi
.PP
If the first character of
.I name
is not `\-',
it is taken as the name of an ASCII
.IR "command file" ,
or
.IR "shell script" ,
which is opened as the standard input
for a new shell instance.
Thus,
the new shell reads and interprets command lines
from the named file.
.PP
Otherwise,
.I name
is taken as one of the shell options,
and a new shell instance is invoked
to read and interpret command lines
from its standard input.
However,
notice that the
.B \-c
option followed by a
.I string
is the one case where
the shell does not read and interpret command lines
from its standard input.
Instead,
the string itself is taken as a command line
and executed.
.PP
In each command line,
an unquoted character sequence of the form `$N',
where
.I N
is a digit,
is treated as a
.I "positional parameter"
by the shell.
Each occurrence of a positional parameter in the
command line is substituted with the value of the
\fIN\fRth argument to the invocation of the shell
(\fIargN\fR).
`$0' is substituted with
.IR name .
.PP
In both interactive and non-interactive shells,
`$$' is substituted with the process ID of
the current shell.
The value is represented as a 5-digit ASCII string,
padded on the left with zeros when the process ID
is less than 10000.
.PP
All substitution on a command line is performed
.I before
the line is interpreted.
Thus,
no action which alters the value of any parameter
can have any effect on a reference to that parameter
occurring on the
.I same
line.
.PP
A positional-parameter value may contain
any number of characters with special meaning
to the shell.
Each one which is
.IR unquoted ,
or
.IR unescaped ,
within a positional-parameter value retains
its special meaning when the value is substituted
in a command line by the invoked shell.
.PP
Take the following two shell invocations for example:
.PP
.nf
% sh6 \-c '$1' 'echo Hello! >/dev/null'
% sh6 \-c '$1' 'echo Hello! \\>/dev/null'
Hello! >/dev/null
.fi
.PP
In the first invocation,
the `>' in the value substituted by `$1'
retains its special meaning.
This causes all output from
.IR echo (1)
to be redirected to `/dev/null'.
However,
in the second invocation,
the meaning of `>' is escaped by `\\'
in the value substituted by `$1'.
This causes the shell to pass `>/dev/null'
as an argument to echo instead of interpreting
it as a redirection.
.SS File name generation
Prior to executing an external command,
the shell scans each argument for
unquoted `*', `?', or `[' characters.
If one or more of these characters appears,
the argument is treated as a
.IR pattern ,
and the shell uses
.IR glob6 (1)
to search for file names which
.I match
it.
Otherwise,
the argument is used as is.
.PP
The meaning of each pattern character is as follows:
.IP o 4
The `*' character in a pattern matches any string of
characters in a file name (including the null string).
.IP o
The `?' character in a pattern matches any single character
in a file name.
.IP o
The `[...]' brackets in a pattern specifies a class of characters
which matches any single file-name character in the class.
Within the brackets,
each character is taken to be a member of the class.
A pair of characters separated by an unquoted `\-' specifies
the class as a range which matches each character lexically
between the first and second member of the pair, inclusive.
A `\-' matches itself when quoted or when first or last
in the class.
.PP
Any other character in a pattern matches itself in a file name.
.PP
Notice that the `.' character at the beginning of a file name,
or immediately following a `/',
is always special in that it must be matched explicitly.
The same is true of the `/' character itself.
.PP
If the pattern contains no `/' characters,
the current directory is always used.
Otherwise,
the specified directory is the one obtained by taking the pattern
up to the last `/' before the first unquoted `*', `?', or `['.
The matching process matches the remainder of the pattern
after this `/' against the files in the specified directory.
.PP
In any event,
a list of file names is obtained from the current
(or specified) directory which match the given pattern.
This list is sorted in ascending ASCII order,
and the new sequence of arguments
replaces the given pattern.
The same process is carried out for each
of the given pattern arguments;
the resulting lists are
.I not
merged.
Finally,
the shell
attempts to execute the command
with the resulting argument list.
.PP
If a pattern argument refers to
a directory which cannot be opened,
a `No\ directory' diagnostic is printed.
.PP
If a command has only
.I one
pattern argument,
a `No\ match' diagnostic is printed if it fails
to match any files.
However,
if a command has more than one pattern argument,
a diagnostic is printed only when they
.I all
fail to match any files.
Otherwise,
each pattern argument failing to match
any files is simply removed from the argument list.
.SS End of file
An end-of-file in the shell's input
causes it to exit.
If the shell is interactive,
this means it exits by default when
the user types an EOT (^D) at the prompt.
If desired,
the user may change or disable
the end-of-file character with
.IR stty (1).
.SS Special commands
The following commands are special in that they are
executed by the shell without creating a new process.
.TP
\fB:\fR [\fIarg ...\fR]
Does nothing and sets the exit status to zero.
.TP
\fBchdir\fR \fIdir\fR [\fI...\fR]
Changes the shell's current working directory to
.IR dir .
.TP
.B exit
Causes the shell to cease execution of a file.
This means exit has no effect at the prompt
of an interactive shell.
.TP
\fBlogin\fR [\fIarg ...\fR]
Replaces the current interactive shell with
.IR login (1).
.TP
\fBnewgrp\fR [\fIarg ...\fR]
Replaces the current interactive shell with
.IR newgrp (1).
.TP
.B shift
Shifts all positional-parameter values to the
left by 1,
so that the old value of `$2' becomes the new
value of `$1' and so forth.
The value of `$0' does not shift.
.TP
.B wait
Waits for all asynchronous processes to terminate,
reporting on abnormal terminations.
.SS Signals (+)
If the shell is interactive,
it ignores the SIGINT, SIGQUIT, and SIGTERM
signals (see
.IR signal (3)).
However,
if the shell is invoked with
any option argument,
it only ignores SIGINT and SIGQUIT.
.PP
If SIGINT, SIGQUIT, or SIGTERM is already ignored
when the shell starts,
it is also ignored by the current shell and all of its
child processes.
Otherwise,
SIGINT and SIGQUIT are reset to the
default action for sequential child processes,
whereas SIGTERM is reset to the default action
for all child processes.
.PP
For any signal not mentioned above,
the shell inherits the signal action (default or ignore)
from its parent process and passes it to its child processes.
.PP
Asynchronous child processes always ignore
both SIGINT and SIGQUIT.
Also,
if such a process has not redirected its
input with a `<', `|', or `^',
the shell automatically redirects it to come from
.IR /dev/null .
.SH "EXIT STATUS (+)"
The exit status of the shell is generally that of
the last command executed prior to end-of-file or
.BR exit .
.PP
However,
if the shell is interactive and detects an error,
it exits with a non-zero status if the user
types an EOT at the next prompt.
.PP
Otherwise,
if the shell is non-interactive and is reading
commands from a file,
any shell-detected error causes the shell
to cease execution of that file.
This results in a non-zero exit status.
.PP
A non-zero exit status returned by the shell
itself is always one of the values described
in the following list,
each of which may be accompanied
by an appropriate diagnostic:
.TP
2
The shell detected a syntax, redirection,
or other error not described in this list.
.TP
125
An external command was found
but did not begin with the proper
magic number or a `#!shell' sequence,
and a valid shell was not specified by
EXECSHELL with which to execute it.
.TP
126
An external command was found
but could not be executed.
.TP
127
An external command was not found.
.TP
>128
An external command was terminated by a signal.
.SH "ENVIRONMENT (+)"
Notice that the concept of `user environment'
was not defined in Sixth Edition UNIX.
Thus,
use of the following environment variables
by this port of the shell is an enhancement:
.TP
.B EXECSHELL
If set to a non-empty string,
the value of this variable is taken as the
path name of the shell which is invoked to
execute an external command when it does not
begin with the proper magic number
or a `#!shell' sequence.
.TP
.B PATH
If set to a non-empty string,
the value of this variable is taken as the
sequence of directories used
by the shell to search for external commands.
Notice that the Sixth Edition UNIX
shell always used the equivalent of `.:/bin:/usr/bin',
not PATH.
.SH FILES
.TP
.I /dev/null
default source of input for asynchronous processes
.SH "SEE ALSO"
awk(1),
echo(1),
env(1),
expr(1),
fd2(1),
glob6(1),
goto(1),
grep(1),
if(1),
kill(1),
login(1),
newgrp(1),
osh(1),
sed(1),
stty(1)
.PP
Osh home page:
http://v6shell.org/
.SH AUTHORS
This port of the Thompson shell is derived from
Sixth Edition UNIX /usr/source/s2/sh.c,
which was principally written by Ken Thompson of Bell Labs.
Jeffrey Allen Neitzel initially ported it in January 2004
and currently maintains it as
.IR sh6 (1).
.SH HISTORY
A
.I sh
command
appeared as
.I /bin/sh
in First Edition UNIX.
.PP
The Thompson shell
was used as the standard command interpreter
through Sixth Edition UNIX.
Then,
in the Seventh Edition,
it was replaced by the Bourne shell.
However,
the Thompson shell
was still distributed with the system as
.I osh
because of known portability problems
with the Bourne shell's memory management
in Seventh Edition UNIX.
.SH LICENSE
See either the LICENSE file which is distributed with
.I osh
or
http://v6shell.org/license/
for full details.
.SH COPYRIGHT
.nf
Copyright (c) 2003-2011
Jeffrey Allen Neitzel. All rights reserved.
Copyright (c) 2001-2002
Caldera International Inc. All rights reserved.
Copyright (c) 1985, 1989, 1991, 1993
The Regents of the University of California. All rights reserved.
.fi
.SH NOTES
Since
.I sh6
does not read any startup files,
it should not be added to the shell database
(see
.IR shells (5))
unless the system administrator is willing
to deal with this fact.
.PP
.I Sh6
has no facilities for setting, unsetting, or otherwise
manipulating environment variables within the shell.
This must be accomplished by using other tools such as
.IR env (1).
.PP
Like the original,
.I sh6
is not 8-bit clean as it uses the high-order bit
of characters for quoting.
Thus,
the only complete character set it can handle
is 7-bit ASCII.
.PP
Notice that certain shell oddities were historically
undocumented in this manual page.
Particularly noteworthy is the fact that there
is no such thing as a usage error.
Thus,
the following shell invocations are perfectly valid:
.PP
.nf
sh6 \-cats_are_nice!!! ': "Good kitty =)"'
sh6 \-tabbies_are_too!
sh6 \-s
.fi
.PP
The first two cases correspond to the
.B \-c
and
.B \-t
options
respectively;
the third case corresponds to the
.B \-
option.
.SH SECURITY
This port of the Thompson shell does not support
being used in a set-ID context.
If the effective user (group) ID of the shell
process is not equal to its real user (group) ID,
the shell prints a diagnostic and exits with a
non-zero status.
The reasons for this are as follows.
.PP
First,
the way in which the shell uses positional parameters
(see
.I "Parameter substitution"
above)
makes it a simple matter to invoke an interactive shell
from a command file if the user knows the name
of the current terminal (if any).
This is distinctly
.I not
a bug and can be very useful in the normal case.
.PP
However,
if the shell did support set-ID execution,
this could possibly allow a user to violate the
security policy on a host where the shell is used.
For example,
if the shell were running a setuid-root command file,
a regular user could invoke an interactive root shell
as a result.
.SH BUGS
The shell makes no attempt to recover from
.IR read (2)
errors and exits
if this system call fails for any reason.