summaryrefslogtreecommitdiffstats
path: root/bin/sh/sh.1
Commit message (Collapse)AuthorAgeFilesLines
* MFC r313659-r313673bapt2017-02-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r313659: Remove space at and of line Reported by: make manlint MFC after: 2 days r313660: Remove empty Li Reported by: make manlint MFC after: 2 days r313661: Escape Ss to avoid confusion by mdoc parser with the Ss macro Reported by: make manlint MFC after: 2 days r313662: Add missing -width after -Bl -tag Reported by: make manlint MFC after: 2 days r313663: Add missing section after .Xr reference r313664: Escape No to avoid confusion with the No macro r313665: Remove useless .Pp after the .Sh macro and remove empty line r313666: Remove empty space at EOL and escept Ed r313667: Remove spaces at EOL and sort correctly the SEE ALSO section r313668: Add missing section in manpage reference r313669: Properly use .An macro before Authors name r313670: Escape Sm to avoid confusion with Sm macro r313671: Use correct date format r313672: Remove useless Li macro r313673: Remove spaces at end of line Reported by: make manlint
* Clarify the explanations for the hostname and FQDN entries.wblock2016-05-311-3/+3
| | | | MFC after: 1 week
* Match the descriptions of the \H and \h prompt string sequences to reality.truckman2016-05-251-3/+3
| | | | | | | They were swapped. X-Confirmed by: jilles MFC after: 1 week
* Fix handling of umtxp resource limit in sh(1)/ulimit(1), limits(1), addkib2016-03-121-1/+6
| | | | | | | | login.conf(5) support. Reviewed by: jilles Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D5610
* sh(1): Document 'cd -'.jilles2016-01-301-6/+19
| | | | | This reflects the changes in r294649 and can therefore not be MFCed by itself.
* sh: Add set -o nolog.jilles2015-08-291-2/+9
| | | | | | | | | | POSIX requires this to prevent entering function definitions in history but this implementation does nothing except retain the option's value. In ksh88, function definitions were usually entered in the history file, even when they came from ~/.profile and the $ENV file, to allow displaying their definitions. This is also the first option that does not have a letter.
* sh(1): libedit has supported multibyte encodings for a while.jilles2015-07-111-4/+2
|
* sh: Fix the trap builtin to be POSIX-compliant for 'trap exit SIG' and 'trap ↵bdrewery2015-04-181-3/+2
| | | | | | | | | | | | | | | | | n n...'. The parser considered 'trap exit INT' to reset the default for both EXIT and INT. This beahvior is not POSIX compliant. This was avoided if a value was specified for 'exit', but then disallows exiting with the signal received. A possible workaround is using ' exit'. However POSIX does allow this type of behavior if the parameters are all integers. Fix the handling for this and clarify its support in the manpage since it is specifically allowed by POSIX. Differential Revision: https://reviews.freebsd.org/D2325 Reviewed by: jilles MFC after: 2 weeks
* sh: Add details about importing the environment and initializing OPTIND.jilles2015-02-221-7/+14
|
* sh(1): Add/improve information about exit status of commands.jilles2014-11-141-10/+24
|
* sh(1): Mention portability issue with shifting zero positional parameters.jilles2014-11-071-2/+3
| | | | | | Per Austin Group issue #459, shifting zero positional parameters may or may not be considered an operand error (which causes the shell to exit in most cases).
* sh(1): Clarify that assignments before commands do not affect expansions.jilles2014-09-211-2/+3
| | | | | PR: 193759 MFC after: 1 week
* sh: Allow enabling job control without a tty in non-interactive mode.jilles2014-09-041-1/+7
| | | | | If no tty is available, 'set -m' is still useful to put jobs in their own process groups.
* sh: Add -h option to SYNOPSISdaichi2014-02-251-3/+3
| | | | | Reviewed by: jilles MFC after: soon
* sh: Allow aliases to force alias substitution on the following word.jilles2014-01-261-1/+15
| | | | | | | | If an alias's value ends with a space or tab, the next word is also checked for aliases. This is a POSIX feature. It is useful with utilities like command and nohup (alias them to themselves followed by a space).
* sh(1): Discourage use of -e.jilles2014-01-031-2/+8
| | | | | Also, do not say that ! before a pipeline is an operator, because it is syntactically a keyword.
* sh(1),limits(1): Document kqueues (-k) rlimit.jilles2013-11-011-2/+7
|
* sh: Make return return from the closest function or dot script.jilles2013-09-041-2/+4
| | | | | | | | | | | | | Formerly, return always returned from a function if it was called from a function, even if there was a closer dot script. This was for compatibility with the Bourne shell which only allowed returning from functions. Other modern shells and POSIX return from the function or the dot script, whichever is closest. Git 1.8.4's rebase --continue depends on the POSIX behaviour. Reported by: Christoph Mallon, avg
* sh(1): A subshell environment has its own rlimits (ulimit).jilles2013-06-141-1/+4
| | | | | | This has always been the case and is intended (just like cd). This matches Austin group issue #706.
* sh(1): Document new features in wait builtin.jilles2013-06-051-4/+9
| | | | PR: 176916
* sh: Improve error handling in read builtin:jilles2013-05-031-2/+9
| | | | | | | | | | | | * If read -t times out, return status as if interrupted by SIGALRM (formerly 1). * If a trapped signal interrupts read, return status 128+sig (formerly 1). * If [EINTR] occurs but there is no trap, retry the read (for example because of a SIGWINCH in interactive mode). * If a read error occurs, write an error message and return status 2. As before, a variable assignment error returns 2 and discards the remaining data read.
* Document a few expansions for the $PS1 and $PS2 environmental variables.joel2013-04-211-1/+25
| | | | | | PR: 173410 Submitted by: Derek Wood <ddwood@outlook.com> Reviewed by: jilles
* Minor mdoc fix.joel2013-03-291-1/+1
|
* sh(1): Mention possible ambiguities with $(( and ((.jilles2013-03-241-1/+14
| | | | | | | | | 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.
* Add FILES section.joel2013-01-221-2/+14
| | | | Discussed with: jilles
* Change the $ENV example to use .shrc instead of .shinit. This is consistentjoel2013-01-201-3/+3
| | | | | | with what we use in /usr/share/skel/dot.profile. Discussed with: jilles
* sh: Simplify cd-hash interaction.jilles2013-01-141-5/+1
| | | | | | | | Instead of rechecking relative paths for all hashed utilities after a cd, track if any utility in cmdtable depends on a relative path in PATH. If there is such a utility, cd clears the entire table. As a result, the '*' in hash no longer happens.
* mdoc: don't nest displays. The markup here isn't adding anything anyway.joel2012-10-141-2/+2
| | | | | | Fixes a mandoc lint warning. Discussed with: brueffer, Jason McIntyre <jmc@kerhand.co.uk>
* Minor mdoc fix.joel2012-09-111-1/+2
|
* sh: Expand assignment-like words specially for export/readonly/local.jilles2012-07-151-1/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | 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. PR: bin/166771
* Minor mdoc nits.joel2012-05-131-2/+2
|
* mdoc: fix column names, indentation, column separation within each row, andjoel2012-04-071-1/+1
| | | | | | | quotation. Also make sure we have the same amount of columns in each row as the number of columns we specify in the head arguments. Reviewed by: brueffer
* Remove trailing whitespace per mdoc lint warningeadler2012-03-291-1/+1
| | | | | | | Disussed with: gavin No objection from: doc Approved by: joel MFC after: 3 days
* Remove superfluous paragraph macro.joel2012-03-251-1/+0
|
* sh(1): Improve documentation of field splitting.jilles2011-11-051-11/+55
|
* sh(1): Extend documentation about subshells.jilles2011-07-101-8/+46
| | | | | | | | | | | 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.
* sh(1): Improve documentation of shell patterns:jilles2011-06-241-5/+10
| | | | | | | | | | | * 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
* sh(1): Document the case command better.jilles2011-06-241-2/+13
| | | | | Suggested by: netchild Reviewed by: gjb
* sh: Add do-nothing -h option.jilles2011-06-181-1/+5
| | | | | | | | | | 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".
* sh: Add case statement fallthrough (with ';&' instead of ';;').jilles2011-06-171-2/+7
| | | | | | | | | | | | 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.
* sh: Add support for named character classes in bracket expressions.jilles2011-06-151-1/+11
| | | | | Example: case x in [[:alpha:]]) echo yes ;; esac
* sh: Save/restore changed variables in optimized command substitution.jilles2011-06-121-5/+2
| | | | | | | | | | | 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.
* sh: Do parameter expansion on ENV before using it.jilles2011-06-101-3/+3
| | | | | | This is required by POSIX, and allows things like ENV=\$HOME/.shrc. Note that tilde expansion is explicitly not performed.
* sh: Do parameter expansion before printing PS4 (set -x).jilles2011-06-091-2/+2
| | | | | | | | | | | | | | | | 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.
* sh: Expand aliases after assignments and redirections.jilles2011-05-211-3/+3
|
* sh: Implement the cd -e flag proposed for the next POSIX issue.jilles2011-05-201-2/+11
| | | | | | | | | 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.
* sh: Add \u/\U support (in $'...') for UTF-8.jilles2011-05-081-2/+2
| | | | | | | | | | 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.
* sh(1): Update BUGS section for UTF-8 support.jilles2011-05-081-2/+7
|
* sh: Add $'quoting' (C-style escape sequences).jilles2011-05-051-2/+71
| | | | | | | | | | | | | | | | | | | | | | | | 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)
* sh(1): Describe subshell environment, command substitution more correctly.jilles2011-03-201-7/+19
| | | | | | | | | | | 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.
OpenPOWER on IntegriCloud