| #
f9e79fac
|
| 12-Oct-2025 |
Matthew Phillips <matthew@matthewphillips.info> |
sh: Implement simple parameter expansion in PS1 and PS2
This change follows a localized approach within getprompt() and avoids full parser reentry. While this means we don't support advanced expansi
sh: Implement simple parameter expansion in PS1 and PS2
This change follows a localized approach within getprompt() and avoids full parser reentry. While this means we don't support advanced expansions like ${parameter#pattern}, it provides POSIX-compliant basic parameter expansion without the complexity of making the parser reentrant. This is sufficient for the vast majority of use cases.
PR: 46441
show more ...
|
| #
e043f372
|
| 24-Nov-2023 |
Warner Losh <imp@FreeBSD.org> |
bin: Automated cleanup of cdefs and other formatting
Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row.
Remov
bin: Automated cleanup of cdefs and other formatting
Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row.
Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/
Sponsored by: Netflix
show more ...
|
| #
90aea514
|
| 23-Nov-2023 |
Warner Losh <imp@FreeBSD.org> |
bin: Remove ancient SCCS tags.
Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl s
bin: Remove ancient SCCS tags.
Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl script.
Sponsored by: Netflix
show more ...
|
| #
a675eaec
|
| 01-Jan-2023 |
Piotr Pawel Stefaniak <pstef@FreeBSD.org> |
sh: implement PS1 \D to print current time
\D{format} yields the result of calling strftime(3) with the provided format and the current time.
When PS4 can use this, it will enable us to easily gene
sh: implement PS1 \D to print current time
\D{format} yields the result of calling strftime(3) with the provided format and the current time.
When PS4 can use this, it will enable us to easily generate timestamps when tracing script execution.
Differential Revision: https://reviews.freebsd.org/D35840
show more ...
|
| #
63b6e661
|
| 01-Jan-2023 |
Piotr Pawel Stefaniak <pstef@FreeBSD.org> |
sh: reindent a for loop in parser.c
Reduce indentation level before a commit that will add new code here.
Reviewed by: jilles Differential Revision: https://reviews.freebsd.org/D37926
|
| #
1d386b48
|
| 16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
|
| #
3cf65f8a
|
| 08-Dec-2022 |
Juraj Lutter <otis@FreeBSD.org> |
sh(1): Allow non-printing characters in prompt strings
Introduce new prompt format characters:
- '\[' starts the sequence of non-printing chatacters - '\]' ends the sequence of non-printing charact
sh(1): Allow non-printing characters in prompt strings
Introduce new prompt format characters:
- '\[' starts the sequence of non-printing chatacters - '\]' ends the sequence of non-printing characters
Within these sequences, the following characters are now supported:
- '\a' emits ASCII BEL (0x07, 007) character - '\e' emits ASCII ESC (0x1b, 033) character - '\r' emits ASCII CR (0x0d, 015) character - '\n' emits ASCII CRLF sequence
These can be used to embed ANSI sequences into prompt strings.
Example in .shrc:
PS1="\[\e[7m\]\u@\h\[\e[0m\]:\w \\$ "
This tries to maintain some degree of compatibility with GNU bash, that uses GNU readline library (which behaves slightly different from BSD editline): It has two "non-printing boundary" characters:
- RL_PROMPT_START_IGNORE (\001) - RL_PROMPT_END_IGNORE (\002)
while BSD editline only has one (when using EL_PROMPT_ESC setting), so for this purpose, ASCII \001 was chosen and both \[ and \] emits this character.
And while here, enlarge PROMPTLEN from 128 to 192 characters.
Reviewed by: jilles Approved by: jilles Differential Revision: https://reviews.freebsd.org/D37701
show more ...
|
| #
72f750dc
|
| 14-Oct-2021 |
Jilles Tjoelker <jilles@FreeBSD.org> |
sh: Fix heredoc at certain places in case and for
After an unescaped newline, there may be a here-document. Some places in case and for did not check for one.
Reviewed by: bdrewery Differential Rev
sh: Fix heredoc at certain places in case and for
After an unescaped newline, there may be a here-document. Some places in case and for did not check for one.
Reviewed by: bdrewery Differential Revision: https://reviews.freebsd.org/D32628
show more ...
|
| #
7e565c55
|
| 30-Jan-2019 |
Dimitry Andric <dim@FreeBSD.org> |
Merge ^/head r343320 through r343570.
|
| #
d81ca439
|
| 24-Jan-2019 |
Edward Tomasz Napierala <trasz@FreeBSD.org> |
Make sh(1) support \u in PS1. This removes one fork/exec on interactive shell startup.
Reviewed by: 0mp (man page), jilles MFC after: 2 weeks Sponsored by: DARPA, AFRL Differential Revision: https:
Make sh(1) support \u in PS1. This removes one fork/exec on interactive shell startup.
Reviewed by: 0mp (man page), jilles MFC after: 2 weeks Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D18790
show more ...
|
| #
20c9381c
|
| 28-Dec-2018 |
Edward Tomasz Napierala <trasz@FreeBSD.org> |
Make sh(1) collapse $HOME into "~" in PS1.
Reviewed by: jilles MFC after: 2 weeks Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D18663
|
| #
f9e79fac
|
| 12-Oct-2025 |
Matthew Phillips <matthew@matthewphillips.info> |
sh: Implement simple parameter expansion in PS1 and PS2
This change follows a localized approach within getprompt() and avoids full parser reentry. While this means we don't support advanced expansi
sh: Implement simple parameter expansion in PS1 and PS2
This change follows a localized approach within getprompt() and avoids full parser reentry. While this means we don't support advanced expansions like ${parameter#pattern}, it provides POSIX-compliant basic parameter expansion without the complexity of making the parser reentrant. This is sufficient for the vast majority of use cases.
PR: 46441
show more ...
|
| #
e043f372
|
| 24-Nov-2023 |
Warner Losh <imp@FreeBSD.org> |
bin: Automated cleanup of cdefs and other formatting
Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row.
Remov
bin: Automated cleanup of cdefs and other formatting
Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row.
Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/
Sponsored by: Netflix
show more ...
|
| #
90aea514
|
| 23-Nov-2023 |
Warner Losh <imp@FreeBSD.org> |
bin: Remove ancient SCCS tags.
Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl s
bin: Remove ancient SCCS tags.
Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl script.
Sponsored by: Netflix
show more ...
|
| #
a675eaec
|
| 01-Jan-2023 |
Piotr Pawel Stefaniak <pstef@FreeBSD.org> |
sh: implement PS1 \D to print current time
\D{format} yields the result of calling strftime(3) with the provided format and the current time.
When PS4 can use this, it will enable us to easily gene
sh: implement PS1 \D to print current time
\D{format} yields the result of calling strftime(3) with the provided format and the current time.
When PS4 can use this, it will enable us to easily generate timestamps when tracing script execution.
Differential Revision: https://reviews.freebsd.org/D35840
show more ...
|
| #
63b6e661
|
| 01-Jan-2023 |
Piotr Pawel Stefaniak <pstef@FreeBSD.org> |
sh: reindent a for loop in parser.c
Reduce indentation level before a commit that will add new code here.
Reviewed by: jilles Differential Revision: https://reviews.freebsd.org/D37926
|
| #
1d386b48
|
| 16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
|
| #
3cf65f8a
|
| 08-Dec-2022 |
Juraj Lutter <otis@FreeBSD.org> |
sh(1): Allow non-printing characters in prompt strings
Introduce new prompt format characters:
- '\[' starts the sequence of non-printing chatacters - '\]' ends the sequence of non-printing charact
sh(1): Allow non-printing characters in prompt strings
Introduce new prompt format characters:
- '\[' starts the sequence of non-printing chatacters - '\]' ends the sequence of non-printing characters
Within these sequences, the following characters are now supported:
- '\a' emits ASCII BEL (0x07, 007) character - '\e' emits ASCII ESC (0x1b, 033) character - '\r' emits ASCII CR (0x0d, 015) character - '\n' emits ASCII CRLF sequence
These can be used to embed ANSI sequences into prompt strings.
Example in .shrc:
PS1="\[\e[7m\]\u@\h\[\e[0m\]:\w \\$ "
This tries to maintain some degree of compatibility with GNU bash, that uses GNU readline library (which behaves slightly different from BSD editline): It has two "non-printing boundary" characters:
- RL_PROMPT_START_IGNORE (\001) - RL_PROMPT_END_IGNORE (\002)
while BSD editline only has one (when using EL_PROMPT_ESC setting), so for this purpose, ASCII \001 was chosen and both \[ and \] emits this character.
And while here, enlarge PROMPTLEN from 128 to 192 characters.
Reviewed by: jilles Approved by: jilles Differential Revision: https://reviews.freebsd.org/D37701
show more ...
|
| #
72f750dc
|
| 14-Oct-2021 |
Jilles Tjoelker <jilles@FreeBSD.org> |
sh: Fix heredoc at certain places in case and for
After an unescaped newline, there may be a here-document. Some places in case and for did not check for one.
Reviewed by: bdrewery Differential Rev
sh: Fix heredoc at certain places in case and for
After an unescaped newline, there may be a here-document. Some places in case and for did not check for one.
Reviewed by: bdrewery Differential Revision: https://reviews.freebsd.org/D32628
show more ...
|
| #
7e565c55
|
| 30-Jan-2019 |
Dimitry Andric <dim@FreeBSD.org> |
Merge ^/head r343320 through r343570.
|
| #
d81ca439
|
| 24-Jan-2019 |
Edward Tomasz Napierala <trasz@FreeBSD.org> |
Make sh(1) support \u in PS1. This removes one fork/exec on interactive shell startup.
Reviewed by: 0mp (man page), jilles MFC after: 2 weeks Sponsored by: DARPA, AFRL Differential Revision: https:
Make sh(1) support \u in PS1. This removes one fork/exec on interactive shell startup.
Reviewed by: 0mp (man page), jilles MFC after: 2 weeks Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D18790
show more ...
|
| #
20c9381c
|
| 28-Dec-2018 |
Edward Tomasz Napierala <trasz@FreeBSD.org> |
Make sh(1) collapse $HOME into "~" in PS1.
Reviewed by: jilles MFC after: 2 weeks Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D18663
|
| #
dc0dbd74
|
| 21-May-2018 |
Jilles Tjoelker <jilles@FreeBSD.org> |
sh: Split CNL syntax category to avoid a check on state[level].syntax
No functional change is intended.
|
| #
29988d0e
|
| 20-May-2018 |
Jilles Tjoelker <jilles@FreeBSD.org> |
sh: Allow unquoted newlines in word in ${param+word} etc.
POSIX requires accepting unquoted newlines in word in parameter expansions like ${param+word}, ${param#word}, although the Bourne shell did
sh: Allow unquoted newlines in word in ${param+word} etc.
POSIX requires accepting unquoted newlines in word in parameter expansions like ${param+word}, ${param#word}, although the Bourne shell did not support it, it is not commonly used and might make it harder to find a missing closing brace.
It was also strange that something like
foo="${bar# }"
was rejected.
Reported by: Martijn Dekker via Robert Elz
show more ...
|
| #
82725ba9
|
| 23-Nov-2017 |
Hans Petter Selasky <hselasky@FreeBSD.org> |
Merge ^/head r325999 through r326131.
|