History log of /freebsd-9.3-release/bin/sh/sh.1
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 267654 19-Jun-2014 gjb

Copy stable/9 to releng/9.3 as part of the 9.3-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 264645 18-Apr-2014 jilles

MFC r260246: sh(1): Discourage use of -e.

Also, do not say that ! before a pipeline is an operator, because it is
syntactically a keyword.


# 264423 13-Apr-2014 jilles

MFC r238468: sh: Expand assignment-like words specially for
export/readonly/local.

Examples:
export x=~
now expands the tilde
local y=$1
is now safe, even if $1 contains IFS characters or metacharacters.

For a word to "look like an assignment", it must start with a name followed
by an equals sign, none of which may be quoted.

The special treatment applies when the first word (potentially after
"command") is "export", "readonly" or "local". There may be quoting
characters but no expansions. If "local" is overridden with a function there
is no special treatment ("export" and "readonly" cannot be overridden with a
function).

If things like
local arr=(1 2 3)
are ever allowed in the future, they cannot call a "local" function. This
would either be a run-time error or it would call the builtin.

This matches Austin Group bug #351, planned for the next issue of POSIX.1.

As for the MFC, it is easy to depend on this feature inadvertently, and
adding this fixes a regression from stable/8 that may be apparent in things
like
local x=${y+a @}.

PR: bin/166771
Relnotes: yes


# 262469 25-Feb-2014 daichi

MFC r262467: sh: Add -h option to SYNOPSIS

Reviewed by: jilles


# 252611 03-Jul-2013 jilles

MFC r251763: sh(1): A subshell environment has its own rlimits (ulimit).

This has always been the case and is intended (just like cd).

This matches Austin group issue #706.


# 252610 03-Jul-2013 jilles

MFC r248870 by joel: Minor mdoc fix in previous commit.


# 252609 03-Jul-2013 jilles

MFC r248692: sh(1): Mention possible ambiguities with $(( and ((.

In some other shells, things like $((a);(b)) are command substitutions.

Also, there are shells that have an extension ((ARITH)) that evaluates an
arithmetic expression and returns status 1 if the result is zero, 0
otherwise. This extension may lead to ambiguity with two subshells starting
in sequence.


# 237216 18-Jun-2012 eadler

MFC r233648:
Remove trailing whitespace per mdoc lint warning

Approved by: cperciva (implicit)


# 229036 30-Dec-2011 jilles

MFC r227122: sh(1): Improve documentation of field splitting.

This describes the POSIX-compliant splitting algorithm that first appeared
in 8.0.


# 225736 22-Sep-2011 kensmith

Copy head to stable/9 as part of 9.0-RELEASE release cycle.

Approved by: re (implicit)


# 223909 10-Jul-2011 jilles

sh(1): Extend documentation about subshells.

Because sh executes commands in subshell environments without forking in
more and more cases (particularly from 8.0 on), it makes sense to describe
subshell environments more precisely using ideas from POSIX, together with
some FreeBSD-specific items.

In particular, the hash and times builtins may not behave as if their state
is copied for a subshell environment while leaving the parent shell
environment unchanged.


# 223522 24-Jun-2011 jilles

sh(1): Improve documentation of shell patterns:

* Shell patterns are also for ${var#pat} and the like.
* An '!' by itself will not trigger pathname generation so do not call it a
meta-character, even though it has a special meaning directly after an
'['.
* Character ranges are locale-dependent.
* A '^' will complement a character class like '!' but is non-standard.

MFC after: 1 week


# 223517 24-Jun-2011 jilles

sh(1): Document the case command better.

Suggested by: netchild
Reviewed by: gjb


# 223281 18-Jun-2011 jilles

sh: Add do-nothing -h option.

POSIX requires a -h option to sh and set, to locate and remember utilities
invoked by functions as they are defined. Given that this
locate-and-remember process is optional elsewhere, it seems safe enough to
make this option do nothing.

POSIX does not specify a long name for this option. Follow ksh in calling it
"trackall".


# 223186 17-Jun-2011 jilles

sh: Add case statement fallthrough (with ';&' instead of ';;').

Replacing ;; with the new control operator ;& will cause the next list to be
executed as well without checking its pattern, continuing until a list ends
with ;; or until the end of the case statement. This is like omitting
"break" in a C "switch" statement.

The sequence ;& was formerly invalid.

This feature is proposed for the next POSIX issue in Austin Group issue
#449.


# 223120 15-Jun-2011 jilles

sh: Add support for named character classes in bracket expressions.

Example:
case x in [[:alpha:]]) echo yes ;; esac


# 223024 12-Jun-2011 jilles

sh: Save/restore changed variables in optimized command substitution.

In optimized command substitution, save and restore any variables changed by
expansions (${var=value} and $((var=assigned))), instead of trying to
determine if an expansion may cause such changes.

If $! is referenced in optimized command substitution, do not cause jobs to
be remembered longer.

This fixes $(jobs $!) again, simplifies the man page and shortens the code.


# 222957 10-Jun-2011 jilles

sh: Do parameter expansion on ENV before using it.

This is required by POSIX, and allows things like ENV=\$HOME/.shrc.

Note that tilde expansion is explicitly not performed.


# 222907 09-Jun-2011 jilles

sh: Do parameter expansion before printing PS4 (set -x).

The function name expandstr() and the general idea of doing this kind of
expansion by treating the text as a here document without end marker is from
dash.

All variants of parameter expansion and arithmetic expansion also work (the
latter is not required by POSIX but it does not take extra code and many
other shells also allow it).

Command substitution is prevented because I think it causes too much code to
be re-entered (for example creating an unbounded recursion of trace lines).

Unfortunately, our LINENO is somewhat crude, otherwise PS4='$LINENO+ ' would
be quite useful.


# 222165 21-May-2011 jilles

sh: Expand aliases after assignments and redirections.


# 222154 20-May-2011 jilles

sh: Implement the cd -e flag proposed for the next POSIX issue.

This reflects failure to determine the pathname of the new directory in the
exit status (1). Normally, cd returns successfully if it did chdir() and the
call was successful.

In POSIX, -e only has meaning with -P; because our -L is not entirely
compliant and may fall back to -P mode, -e has some effect with -L as well.


# 221669 08-May-2011 jilles

sh: Add \u/\U support (in $'...') for UTF-8.

Because we have no iconv in base, support for other charsets is not
possible.

Note that \u/\U are processed using the locale that was active when the
shell started. This is necessary to avoid behaviour that depends on the
parse/execute split (for example when placing braces around an entire
script). Therefore, UTF-8 encoding is implemented manually.


# 221660 08-May-2011 jilles

sh(1): Update BUGS section for UTF-8 support.


# 221513 05-May-2011 jilles

sh: Add $'quoting' (C-style escape sequences).

A string between $' and ' may contain backslash escape sequences similar to
the ones in a C string constant (except that a single-quote must be escaped
and a double-quote need not be). Details are in the sh(1) man page.

This construct is useful to include unprintable characters, tabs and
newlines in strings; while this can be done with a command substitution
containing a printf command, that needs ugly workarounds if the result is to
end with a newline as command substitution removes all trailing newlines.

The construct may also be useful in future to describe unprintable
characters without needing to write those characters themselves in 'set -x',
'export -p' and the like.

The implementation attempts to comply to the proposal for the next issue of
the POSIX specification. Because this construct is not in POSIX.1-2008,
using it in scripts intended to be portable is unwise.

Matching the minimal locale support in the rest of sh, the \u and \U
sequences are currently not useful.

Exp-run done by: pav (with some other sh(1) changes)


# 219806 20-Mar-2011 jilles

sh(1): Describe subshell environment, command substitution more correctly.

POSIX does not require the shell to fork for a subshell environment, and we
use that possibility in various ways (command substitutions with a single
command and most subshells that are the final command of a shell process).
Therefore do not tie subshells to forking in the man page.

Command substitutions with expansions are a bit strange, causing a fork for
$(...$(($x))...) because $x might expand to y=2; they will probably be
changed later but this is how they work now.


# 219350 06-Mar-2011 jilles

sh(1): Reduce excessive semicolon-separated sentences.

Reported by: Benjamin Kaduk


# 218467 08-Feb-2011 jilles

sh(1): Update description of arithmetic.


# 218320 05-Feb-2011 jilles

sh: Do not try to execute binary files as scripts.

If execve() returns an [ENOEXEC] error, check if the file is binary before
trying to execute it using sh. A file is considered binary if at least one
of the first 256 bytes is '\0'.

In particular, trying to execute ELF binaries for the wrong architecture now
fails with an "Exec format error" message instead of syntax errors and
potentially strange results.


# 218306 04-Feb-2011 jilles

sh: Remove special code for shell scripts without magic number.

These are called "shell procedures" in the source.

If execve() failed with [ENOEXEC], the shell would reinitialize itself
and execute the program as a script. This requires a fair amount of code
which is not frequently used (most scripts have a #! magic number).
Therefore just execute a new instance of sh (_PATH_BSHELL) to run the
script.


# 217473 16-Jan-2011 jilles

sh(1): Document changes to 'exit' from traps.


# 216630 21-Dec-2010 jilles

sh(1): Explain why it is a bad idea to use aliases in scripts.


# 216629 21-Dec-2010 jilles

sh: Add kill builtin.

This allows specifying a %job (which is equivalent to the corresponding
process group).

Additionally, it improves reliability of kill from sh in high-load
situations and ensures "kill" finds the correct utility regardless of PATH,
as required by POSIX (unless the undocumented %builtin mechanism is used).

Side effect: fatal errors (any error other than kill(2) failure) now return
exit status 2 instead of 1. (This is consistent with other sh builtins, but
not in NetBSD.)

Code size increases about 1K on i386.

Obtained from: NetBSD


# 216168 03-Dec-2010 jilles

sh(1): Clean up documentation of built-in commands.

Make sure all built-in commands are in the subsection named such, except
exp, let and wordexp which are deliberately undocumented. The text said only
built-ins that really need to be a built-in were documented there but in
fact almost all of them were already documented.


# 216100 01-Dec-2010 jilles

sh(1): Document that command's -p option also works with -v/-V.

This was implemented in r201343.


# 215520 19-Nov-2010 jilles

sh: Add printf builtin.

This was removed in 2001 but I think it is appropriate to add it back:
* I do not want to encourage people to write fragile and non-portable echo
commands by making printf much slower than echo.
* Recent versions of Autoconf use it a lot.
* Almost no software still wants to support systems that do not have
printf(1) at all.
* In many other shells printf is already a builtin.

Side effect: printf is now always the builtin version (which behaves
identically to /usr/bin/printf) and cannot be overridden via PATH (except
via the undocumented %builtin mechanism).

Code size increases about 5K on i386. Embedded folks might want to replace
/usr/bin/printf with a hard link to /usr/bin/alias.


# 215210 12-Nov-2010 jilles

sh(1): Document r214304 (special builtin is illegal function name).


# 215209 12-Nov-2010 jilles

sh(1): Update for r214492. "${v+"hi}there"}".

The part hi}there is not a quoted string but nevertheless the closing brace
does not terminate the expansion.


# 215181 12-Nov-2010 jilles

sh(1): Modernize the introduction a bit.

In particular, remove the text about ksh-like features, which are usually
taken for granted nowadays. The original Bourne shell is fading away and for
most users our /bin/sh is one of the most minimalistic they know.


# 214609 31-Oct-2010 jilles

sh(1): Correct synopsis and make precise how $0 is set.

In particular, the extra argument to set $0 with -c was not documented.

MFC after: 1 week


# 213926 16-Oct-2010 jilles

sh(1): Clarify subshells/processes for pipelines.

For multi-command pipelines,
1. all commands are direct children of the shell (unlike the original
Bourne shell)
2. all commands are executed in a subshell (unlike the real Korn shell)

MFC after: 1 week


# 212417 10-Sep-2010 jilles

sh(1): Remove xrefs for expr(1) and getopt(1).

expr(1) should usually not be used as various forms of parameter expansion
and arithmetic expansion replicate most of its functionality in an easier
way.

getopt(1) should not be used at all in new code. Instead, getopts(1) or
entirely manual parsing should be used.

MFC after: 1 week


# 211621 22-Aug-2010 jilles

sh(1): Add a brief summary of arithmetic expressions.


# 209600 29-Jun-2010 jilles

sh: Forget about terminated background processes sooner.

Unless $! has been referenced for a particular job or $! still contains that
job's pid, forget about it after it has terminated. If $! has been
referenced, remember the job until the wait builtin has reported its
completion (either with the pid as parameter or without parameters).

In interactive mode, jobs are forgotten after termination has been reported,
which happens before primary prompts and through the jobs builtin. Even
then, though, remember a job if $! has been referenced.

This is similar to what is suggested by POSIX and should fix most memory
leaks (which also tend to cause sh to use more CPU time) with long running
scripts that start background jobs.

Caveats:
* Repeatedly referencing $! without ever doing 'wait', like
while :; do foo & echo started foo: $!; sleep 60; done
will still use a lot of memory and CPU time in the long run.
* The jobs and jobid builtins do not cause a job to be remembered for longer
like expanding $! does.

PR: bin/55346


# 208505 24-May-2010 jilles

sh(1): Rework documentation of shell variables.

* Move the "environment variables" that do not need exporting to be
effective or that are set by the shell without exporting to a new section
"Special Variables".
* Add special variables LINENO and PPID.
* Add environment variables LANG, LC_* and PWD; also describe ENV under
environment variables.


# 208501 24-May-2010 jilles

sh(1): Improve wording of 'Special Parameters' section.


# 207831 09-May-2010 jilles

sh(1): Fix "reserved word" vs "keyword" inconsistency.
Use "keyword" everywhere, like the output of the 'type' builtin, and only
mention "reserved word" once to say it is the same thing.


# 206182 05-Apr-2010 jilles

sh: Automatically enable -o emacs in interactive shells with terminals.

This makes sh a bit more friendly in single user mode, make buildenv, chroot
and the like, and matches other shells.

The -o emacs can be overridden on the command line or in the ENV file.


# 206158 04-Apr-2010 jilles

sh: Document the expansion changes in the man page.

Note that the following sentence
> Enclosing the full parameter expansion string in double-quotes does not
> cause the following four varieties of pattern characters to be quoted,
> whereas quoting characters within the braces has this effect.
is now true, but used to be incorrect.


# 204800 06-Mar-2010 jilles

sh: Improve the command builtin:
* avoid unnecessary fork
* allow executing builtins via command
* executing a special builtin via command removes its special properties

Obtained from: NetBSD (parts)


# 201355 31-Dec-2009 jilles

sh(1): document ulimit -w (swapuse rlimit).

MFC after: 1 week


# 201354 31-Dec-2009 jilles

sh(1): Correct two places where "$@" lacked necessary quotes.

MFC after: 1 week


# 198454 24-Oct-2009 jilles

sh: Exempt $@ and $* from set -u

This seems more useful and will likely be in the next POSIX standard.

Also document more precisely in the man page what set -u does (note that
$@, $* and $! are the only special parameters that can ever be unset, all
the others are always set, although they may be empty).


# 197848 07-Oct-2009 jilles

Clarify quoting of word in ${v=word} in sh(1).


# 197371 20-Sep-2009 jilles

Mention that NUL characters are not allowed in sh(1) input.

I do not consider this a bug because POSIX permits it and argument strings
and environment variables cannot contain '\0' anyway.

PR: bin/25542
MFC after: 2 weeks


# 194922 24-Jun-2009 jilles

Designate special builtins as such in command -V and type.
Also document various properties of special builtins that we implement.

Approved by: ed (mentor) (implicit)


# 193636 07-Jun-2009 jilles

Mention the range for the exit status for the exit special builtin.

The exit status may exceed 255 in some cases (return); even though it seems
unwise to rely on this, it is also unwise to assume that $? is always
between 0 and 255.

This resolves bin/124748 by documenting that 'exit -1' is not valid.

PR: bin/124748
Approved by: ed (mentor)


# 193185 31-May-2009 jilles

sh: Make read's timeout (-t) apply to the entire line, not only the first
character.

This avoids using non-standard behaviour of the old (upto FreeBSD 7) TTY
layer: it reprocesses the input queue when switching to canonical mode. The
new TTY layer does not provide this functionality and so read -t worked
very poorly (first character is not echoed, cannot be backspaced but is
still read).

This also agrees with what most other shells with read -t do.

PR: bin/129566
Reviewed by: stefanf
Approved by: ed (mentor)


# 182489 30-Aug-2008 ed

Document the ulimit -p option in the sh(1) manual page.

When I imported the MPSAFE TTY code, I added the -p flag to sh(1)'s
ulimit, but I forgot to document it in the appropriate manual page.

Requested by: stefanf


# 174287 05-Dec-2007 ru

Revise the markup.


# 172440 04-Oct-2007 stefanf

The exit status of a case statement where none of the patterns is matched
is supposed to be 0, not the status of the previous command.

Reported by: Eygene Ryabinkin
PR: 116559
Approved by: re (gnn)


# 163085 07-Oct-2006 stefanf

Add the POSIX option -p to the jobs builtin command. It prints the PID of the
process leader for each job. Now the last specified option for the output
format (-l, -p or -s) wins, previously -s trumped -l.

PR: 99926
Submitted by: Ed Schouten and novel (patches modified by me)


# 162379 17-Sep-2006 ru

Markup fixes.


# 160812 29-Jul-2006 yar

Tell more of the sh(1) history.
Acknowledge Kenneth Almquist's contribution in AUTHORS.

MFC after: 5 days


# 160694 26-Jul-2006 yar

Make it easier to find that we have test(1) built-in in sh(1).

MFC after: 3 days


# 159836 21-Jun-2006 yar

Document the fact that 'true' and 'false' are among sh(1) built-in commands.

MFC after: 3 days


# 159632 15-Jun-2006 stefanf

Implement the PS4 variable which is defined by the POSIX User Portability
Utilities option. Its value is printed at the beginning of the line if tracing
(-x) is active. PS4 defaults to the string "+ " which is compatible with the
old behaviour to always print "+ ".

We still need to expand variables in PS1, PS2 and PS4.

PR: 46441 (part of)
Submitted by: schweikh
Obtained from: NetBSD


# 153951 01-Jan-2006 stefanf

Document that '#' starts a comment.

PR: 85103
Submitted by: garys
Obtained from: pdksh manual
Patch from: Daniel Gerzo (with changes by me)


# 153246 08-Dec-2005 stefanf

- Document trap's -l option and the behaviour of a missing action or a single
dash.
- Discourage the omission of the action.

PR: 70985 [1]
Submitted by: Martin Kammerhofer


# 153240 08-Dec-2005 stefanf

Clarify that the echo builtin takes an arbitrary number of strings.
Mention that spaces are printed between the strings.


# 153091 04-Dec-2005 stefanf

Add the times builtin. It reports the user and system time for the shell
itself and its children. Instead of calling times() (as implied by POSIX) this
implementation directly calls getrusage() to get the times because this is more
convenient.


# 152547 17-Nov-2005 ru

-mdoc sweep.


# 151984 02-Nov-2005 jcamou

Add `local' and `return' to the list of built-ins.

Submitted by: garys
Approved by: trhodes (mentor)


# 151858 29-Oct-2005 stefanf

Document command -v and -V.

Glanced at by: simon


# 151856 29-Oct-2005 stefanf

Document that read -t timeout returns 1 if the timeout elapses.


# 149938 10-Sep-2005 stefanf

Elaborate on the behaviour of set -e.


# 149920 09-Sep-2005 stefanf

Split the export synopsis into two lines as -p cannot be mixed with variable
names.


# 149816 06-Sep-2005 rse

fix typo: ommitted -> omitted


# 149763 03-Sep-2005 stefanf

Document that `in word ...' is optional in the for command.


# 149740 02-Sep-2005 stefanf

Document that unalias can be used to remove several alias names.


# 149604 29-Aug-2005 jcamou

Wrap a line due to a new sentence.

Noticed by: simon
Approved by: trhodes (mentor)


# 149562 29-Aug-2005 jcamou

o Discuss the ways to escape an alias.
o Fix the alias syntax lines.
o Refer to the Aliases subsection.

PR: docs/84914
Submitted by: garys
Approved by: trhodes (mentor)
MFC after: 3 days


# 149209 17-Aug-2005 stefanf

Document umask's -S option.


# 147362 14-Jun-2005 ru

Sorted sections and fixed prompt (PS[12]) strings.

Approved by: re (blanket)


# 147361 14-Jun-2005 ru

Put the description of the -c option in the right place, as
promised by the Argument List Processing section introduction.
What follows the option in the options list is its long name,
not its argument (as is the case for the -c option). Also
sort references in the SEE ALSO section.

Approved by: re (blanket)


# 145115 15-Apr-2005 keramida

Various sh(1) enhancements:
- Move the description of the ``-c string'' option closer to the option itself.
- Add an ENVIRONMENT section (1)
- Add more .Xr cross references to the SEE ALSO section.

Obtained from: NetBSD (1)


# 143125 04-Mar-2005 keramida

Use ``.Pq Ql'' to quote single characters, instead of ``.Pq Li''.
This makes the resulting output more aesthetically pleasing in
text-only terminals:

Reviewed by: ru


# 143124 04-Mar-2005 keramida

Add a section describing the exit status of the shell.

Obtained from: NetBSD


# 139969 10-Jan-2005 imp

/*- or .\"- or #- to begin license clauses.


# 139943 09-Jan-2005 ru

Scheduled mdoc(7) sweep.


# 139673 04-Jan-2005 ceri

Correct typo.


# 138313 02-Dec-2004 maxim

o Add a missed "." .

Reviewed by: ru
MFC after: 3 weeks


# 137113 01-Nov-2004 alfred

When listing the special $ variables, ($!, $#, etc) list them as $!
instead of just !, this allows one to more easily locate/understand
the section of the manpage in question.

Additional wording correction by: keramida
Reviewed by: keramida


# 131513 03-Jul-2004 tjr

Document missing multibyte character handling in utilities specified
by POSIX.


# 131484 02-Jul-2004 ru

Mechanically kill hard sentence breaks.


# 128233 14-Apr-2004 green

Document the "return" built-in better: it will exit . (sources) and
the top-level shell instance, too.


# 127958 06-Apr-2004 markm

Remove clause 3 from the UCB licenses.

OK'ed by: imp, core


# 119893 08-Sep-2003 ru

mdoc(7): Use the new feature of the .In macro.


# 115082 16-May-2003 ru

mdoc(7) police: A better version of the same.

Approved by: re (blanket)


# 114318 30-Apr-2003 schweikh

Fix references to non-existing or obsoleted man pages.

PR: docs/51480 (only a small part)
Submitted by: Diomidis D. Spinellis <dds@aueb.gr>


# 113379 12-Apr-2003 tjr

Document the -L and -P options to the cd and pwd commands as being
mutually exclusive. The fact that the most recent one specified on the
command line is the one that takes effect is an implementation detail and
users should not rely on this.


# 110302 03-Feb-2003 fanf

Improve the layout of the description of the various parameter expansion
modifiers. The paragraph that explains the difference between ${foo:-bar}
and ${foo-bar} etc. was not very visible.


# 108257 24-Dec-2002 ru

mdoc(7) police: Deal with self-xrefs.


# 108216 23-Dec-2002 ru

mdoc(7) police: markup nit.


# 107993 17-Dec-2002 trhodes

The code uses trapsasync, however the manual page uses asynctraps. Fix the
manual page to reflect the code.

PR: 45820
Submitted by: Marco Molteni <molter@tin.it>
Discussed with: tjr


# 107974 17-Dec-2002 fanf

Document `trap EXIT` and `trap SIGNAME`.


# 102363 24-Aug-2002 tjr

There is a built-in command called "builtin"; spell its name correctly
after rev. 1.77 called it "built-in".


# 102230 21-Aug-2002 trhodes

s/filesystem/file system/ as discussed on -developers


# 102223 21-Aug-2002 schweikh

Fix a few typos, among them s/builtin/built-in/ (except for the ref
to the builtin(1) man page.) This is for consistency with the spelling
both proposed by ispell as well as IEEE Std 1003.1-2001.

MFC after: 3 days


# 101573 09-Aug-2002 ru

mdoc(7) police: tidying.


# 100664 25-Jul-2002 tjr

Add a -P/-o physical option which behaves similarly to bash/ksh's options
by the same name. This option makes the cd and pwd builtins behave physically
(as opposed to logically) by default.

Submitted by: fanf


# 100565 23-Jul-2002 tjr

Add a `bind' builtin command, which is simply a wrapper around libedit's
builtin command of the same name. This allows the key bindings for the
shell's line editor to be changed.

MFC after: 2 weeks


# 100437 21-Jul-2002 tjr

Implement the P1003.2 `command' builtin command, which is used to suppress
shell function and alias lookup. The -p option has been implemented, the
UPE -v and -V options have not. The old `command' command has been renamed
to `builtin'.


# 100395 20-Jul-2002 tjr

Document that only one of the -n and -e options may be specified for
sh(1)'s echo(1) builtin command.

PR: 32935, 40747
MFC after: 1 week


# 99267 02-Jul-2002 dillon

Fix type-o in last commit in preparation for MFC.


# 98919 27-Jun-2002 sheldonh

Document addition of RLIMIT_VMEM support, added in rev 1.26 of miscbltin.c.


# 98427 19-Jun-2002 tjr

Bring documentation on CDPATH and its effects on cd(1) back into sync with
reality (and POSIX): current directory isn't searched unless CDPATH has
a "." element or is unset.

PR: 38442
Submitted by: oleg dashevskii <be9@be9.ru>
MFC after: 1 week


# 97916 06-Jun-2002 tjr

Document the -f and -v options of the unset builtin.


# 97914 06-Jun-2002 tjr

Add the SUSv3 -p ("portable") option to both the export and readonly
builtins. This makes export/readonly print lines in the form
"export name=value".


# 97815 04-Jun-2002 tjr

Quote alias values in the output of the alias(1) builtin so they are
suitable for re-input to the shell (SUSv3)


# 97669 31-May-2002 tjr

Add -s (output PID's only) and -l (show PID's) options to the jobs(1)
builtin. Modify the output format to match what SUSv3 requires.


# 97465 29-May-2002 ru

mdoc(7) police: tidy up the markup a bit.


# 97277 25-May-2002 tjr

sh appeared in Version 1, not System V.1.


# 97276 25-May-2002 tjr

Implement `set +o', which displays the currently set options in a format
suitable for re-input into the shell.


# 96980 20-May-2002 tjr

Add the SUSv3 -L and -P options to the cd and pwd builtin utilities. `Logical'
handling of .. is now the default.


# 96939 19-May-2002 tjr

Implement the -u (-o nounset) option, which gives an error message if
an unset variable is expanded.

Obtained from: NetBSD (bjh21, christos)


# 96922 19-May-2002 tjr

Implement the -C (-o noclobber) option, which prevents existing regular
files from being overwritten by shell redirection.


# 86693 20-Nov-2001 knu

(null commit to correct the previous log message)

Now that all the printf invocations from within the system startup
scripts *have been replaced with equivalent handmade functions*, we
can safely remove it.

Please steal the technique from src/etc/MAKEDEV when you want to use
printf(1) functionality from within the system rc scripts.


# 86692 20-Nov-2001 knu

Remove the printf builtin command from sh(1), which command is not
used so often that it's worth keeping it as a builtin.

Now that all the printf invocations from within the system startup
scripts, we can safely remove it.

Urged by: sheldonh :)

No MFC is planned so far because it may break compatibility and
violate POLA.


# 86505 17-Nov-2001 knu

Make test(1) a builtin command of our sh(1) for efficiency. The
binary size increase is 3,784 bytes (about 0.6%).

I don't drop the printf builtin while I'm here because some /etc/rc.*
scripts seem to use it before mounting /usr where printf(1) resides.

Reviewed by: arch (sheldonh)
Inspired by: NetBSD, ksh
Clued by: ume (on how the printf builtin is used)


# 81298 08-Aug-2001 sheldonh

can not -> cannot


# 81251 07-Aug-2001 ru

mdoc(7) police:

Avoid using parenthesis enclosure macros (.Pq and .Po/.Pc) with plain text.
Not only this slows down the mdoc(7) processing significantly, but it also
has an undesired (in this case) effect of disabling hyphenation within the
entire enclosed block.


# 80196 23-Jul-2001 sheldonh

Break the list of parameter expansions into two lists so that
the paragraph introducing the prefix and suffix pattern expansions
does not appear as part of the explanation for the string length
expansion.


# 79526 10-Jul-2001 ru

mdoc(7) police: removed HISTORY info from the .Os call.


# 79366 06-Jul-2001 ru

mdoc(7) police: sort SEE ALSO xrefs (sort -b -f +2 -3 +1 -2).


# 78686 23-Jun-2001 dd

Remove duplicate words.


# 76090 28-Apr-2001 dd

Document "chdir" builtin.


# 71895 01-Feb-2001 ru

mdoc(7) police: split punctuation characters + misc fixes.


# 71097 16-Jan-2001 ru

Prepare for mdoc(7)NG.


# 70150 18-Dec-2000 ru

Prepare for mdoc(7)NG.


# 70056 15-Dec-2000 ru

Prepare for mdoc(7)NG.


# 69050 22-Nov-2000 ru

mdoc(7) police: Er macro usage cleanup.


# 66612 03-Oct-2000 brian

Implement the <> redirection operator.


# 63799 24-Jul-2000 sheldonh

Mark up the -a flag to unalias as a flag (Fl), not an argument (Ar).


# 63798 24-Jul-2000 sheldonh

Add missing punctuation to one line.


# 63359 17-Jul-2000 marko

Document the builtin echo command

Reviewed by: Matthew Hunt <mph@astro.caltech.edu>


# 54643 15-Dec-1999 cracauer

Document ulimit -b for RLIMIT_SBSIZE.


# 54145 05-Dec-1999 cracauer

make '|' character visible.

PR: docs/15265
Submitted by: takamune@avrl.mei.co.jp


# 53349 18-Nov-1999 sheldonh

Follow-up on mdoc fixes in rev 1.35; this includes things that I missed
in that revision as well as things I broke in that revision. A note-
worthy instance of the latter case was the inversion of -E and -V in the
subsection on Commandline Editing.


# 53081 10-Nov-1999 sheldonh

Don't call bash(1) a Korn shell clone. Instead, use pdksh(1) as an
example of such a clone.

PR: 14601
Submitted by: Matthias Buelow <mkb@altair.mayn.de>


# 51985 07-Oct-1999 sheldonh

Mdoc cleanup, with a few grammar cleanups on the side.

Reviewed by: mpp


# 51275 14-Sep-1999 sheldonh

Correct some hard sentence breaks. Only those surrounding the previous
commit and those which cause ugly nroff output have been fixed, since
the purpose of the style guideline which they contravene is to reduce
the sizes of deltas.

Reported by: bde


# 51090 08-Sep-1999 sheldonh

Improve shell documentation:

* Consistently misspell built-in as builtin.

* Add a builtin(1) manpage and create builtin(1) MLINKS for all shell
builtin commands for which no standalone utility exists. These MLINKS
replace those that were created for csh(1).

* Add appropriate xrefs for builtin(1) to the csh(1) and sh(1) manpages,
as well as to the manpages of standalone utilities which are supported
as shell builtin commands in at least one of the shells. In such
manpages, explain that similar functionality may be provided as a
shell builtin command.

* Improve sh(1)'s description of the cd builtin command. Csh(1) already
describes it adequately. Replace the cd(1) manpage with a builtin(1)
MLINKS link.

* Clean up some mdoc problems: use Xr instead of literal "foo(n)"; use
Ic instead of Xr for shell builtin commands.

* Undo English contractions.

Reviewed by: mpp, rgrimes


# 50698 31-Aug-1999 sheldonh

Revert to using .Xr for builtins. The cross-references don't work now,
but that doesn't mean that they will never work.

Requested by: mpp, rgrimes


# 50648 30-Aug-1999 sheldonh

Clean-up:

Fix grammar and spelling nits.
Use .Dq and .Qq where appropriate.
Divorce trailing punctuation from quoted elements.
Use .Dq instead of .Xr for builtins.
Remove trailing whitespace and blank lines.

PR: 13340


# 50471 27-Aug-1999 peter

$Id$ -> $FreeBSD$


# 50394 26-Aug-1999 tg

Make the behaviour of `read -e', ie. treating backslashes as special,
the default. Add -r option for the read builtin to reverse this.

PR: 13274
Reviewed by: cpiazza, hoek, sheldonh


# 45834 19-Apr-1999 max

Typo fix.


# 45263 03-Apr-1999 cracauer

Implement -a flag. A test shell script can be found at
http://www.cons.org/cracauer/download/sh-interrupt/testsuite/test_export.sh
The PR also had test cases the new version passes.

Fix typo in comment.

PR: bin/1030


# 45243 02-Apr-1999 cracauer

-T was missing in the synopsis line.

Submitted by: BDE


# 45221 01-Apr-1999 cracauer

The immediate execution of traps I introduced in September 1998 (to
make /etc/rc interruptible in cases when programs hang with blocked
signals) isn't standard enough.

It is now switched off by default and a new switch -T enables it.

You should update /etc/rc to the version I'm about to commit in a few
minutes to keep it interruptible.


# 45202 31-Mar-1999 brian

sh doesn't support <> redirections.
PR: 7325


# 41916 18-Dec-1998 jkoshy

Add references to test(1) and expr(1).


# 41467 02-Dec-1998 billf

Fix typo. "If the an entry" --> "If an entry"

PR: docs/8140
Submitted by: Sue Blake <sue@vedanix.welearn.com.au>


# 37968 30-Jul-1998 jkoshy

Document behaviour of "-" and "--" on the command line.

PR: docs/5399


# 36150 18-May-1998 charnier

Add rcsid. Spelling.


# 33261 11-Feb-1998 jdp

Explicitly describe the rules the shell uses to search for a file
sourced by the "." command.


# 32194 02-Jan-1998 steve

Correct a bogon in an example.

PR: 5415
Submitted by: Sergei S. Laskavy <laskavy@pc759.cs.msu.su>


# 31128 12-Nov-1997 jdp

Document the exit status for a command that was terminated by a
signal.


# 29983 29-Sep-1997 msmith

Add the '-t timeout' option to the 'read' builtin. This allows the
'read' command to return an error if the user fails to supply any
input withink a given time period. The behaviour of this option is
similar to that of the like-named option in ksh93.

Reviewed by: joerg


# 29332 13-Sep-1997 wosch

PR: docs/4449
The -c flag is not documented in the sh(1) manapge.

Submitted by: adrian@virginia.edu


# 25529 07-May-1997 steve

Revise the section that explains how to protect parts of an $ENV script
from being executed in non-interactive mode.

Suggested and Reviewed by: Brian Somers <brian@freebsd.org>


# 25229 28-Apr-1997 steve

mdoc-ify and cleanup UNIMPLEMENTED messages. Closes PR 2880.


# 22988 22-Feb-1997 peter

Revert $FreeBSD$ to $Id$


# 21673 14-Jan-1997 jkh

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.


# 20425 14-Dec-1996 steve

Merge in NetBSD mods and -Wall cleaning.

Obtained from: NetBSD, me


# 19240 29-Oct-1996 steve

Add the -p (privileged) commandline switch
found in bash, zsh, and friends.

Reviewed by: joerg


# 18018 03-Sep-1996 peter

Fix for PR#1287. This makes sh behave sensibly in case statements in the
face of aliases. Note, bash doesn't do aliases while running scripts, but
"real" ksh does..

Also:
Reduce redundant .Nm macros in (unused) bltin/echo.1
nuke error2, it's hardly used.
More -Wall cleanups
dont do certain history operations if NO_HISTORY defined
handle quad_t's from resource limits

Submitted by: Steve Price <sprice@hiwaay.net> (minor tweaks by me)


# 17987 01-Sep-1996 peter

Merge of 4.4-Lite2 sh source, plus some gcc -Wall cleaning. This is a
merge of parallel duplicate work by Steve Price and myself. :-]

There are some changes to the build that are my fault... mkinit.c was
trying (poorly) to duplicate some of the work that make(1) is designed to
do. The Makefile hackery is my fault too, the depend list was incomplete
because of some explicit OBJS+= entries, so mkdep wasn't picking up their
source file #includes.

This closes a pile of /bin/sh PR's, but not all of them..

Submitted by: Steve Price <steve@bonsai.hiwaay.net>, peter


# 17891 29-Aug-1996 wosch

[HISTORY] command appeared in Version 1 AT&T UNIX
Obtained from: A Quarter Century of UNIX, Peter H. Salus, page 41


# 11601 20-Oct-1995 joerg

o rename ulimit -p into ulimit -u, so we are in agreement with bash

o fix brokeness for 1>&5 redirection, where `5' was an invalid file
descriptor, but no error message has been generated

o fix brokeness for redirect to/from myself case


# 11571 19-Oct-1995 joerg

Implement the "ulimit" builtin. This is the analogon to csh's "limit"
command and badly needed in sh(1) for everybody who wants to modify
the system-wide limits from inside /etc/rc.

The options are similar to other system's implemantations of this
command, with the FreeBSD additions for -m (memoryuse) and -p (max
processes) that are not available on other systems.


# 8294 05-May-1995 adam

typo there --> their


# 3044 24-Sep-1994 dg

Added $Id$


# 1557 26-May-1994 rgrimes

This commit was generated by cvs2svn to compensate for changes in r1556,
which included commits to RCS files with non-trunk default branches.


# 1556 26-May-1994 rgrimes

BSD 4.4 Lite bin Sources