mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-06-27 07:43:07 +02:00
commit bash-20101025 snapshot
This commit is contained in:
@@ -1,3 +1,292 @@
|
||||
This document details the changes between this version, bash-4.2-alpha,
|
||||
and the previous version, bash-4.1-release.
|
||||
|
||||
1. Changes to Bash
|
||||
|
||||
a. Fixed a bug in the parser when processing alias expansions containing
|
||||
quoted newlines.
|
||||
|
||||
b. Fixed a memory leak in associative array expansion.
|
||||
|
||||
c. Fixed a bug that caused quoted here-strings to be requoted when printed.
|
||||
|
||||
d. Fixed a bug in arithmetic expansion that caused the index in an array
|
||||
expansion to be evaluated twice under certain circumstances.
|
||||
|
||||
e. Fixed several bugs with the expansion and display of variables that have
|
||||
been given attributes but not values and are technically unset.
|
||||
|
||||
f. Fixed a bug that caused core dumps when using filename completion that
|
||||
expands to a filename containing a globbing character.
|
||||
|
||||
g. Fixed a bug that caused assignment statements preceding a special builtin
|
||||
when running in Posix mode to not persist after the builtin completed
|
||||
when the special builtin was executed in a shell function without any
|
||||
local variables.
|
||||
|
||||
h. Fixed a bug that caused a command to remain in the hash table even after
|
||||
`hash command' did not find anything if there was already an existing
|
||||
hashed pathname.
|
||||
|
||||
i. Fixed several bugs caused by executing unsafe functions from a signal
|
||||
handler in the cases where a signal handler is executed immediately
|
||||
rather than setting a flag for later execution.
|
||||
|
||||
j. Fixed a bug that caused some internal flag variables to be set
|
||||
incorrectly if `read -t' timed out.
|
||||
|
||||
k. Fixed a Posix compatibility issue by making sure that a backslash escaping
|
||||
a `}' within a double-quoted ${...} parameter expansion is removed as part
|
||||
of the parameter expansion.
|
||||
|
||||
l. Fixed a bug that caused execution of a trap to overwrite PIPESTATUS.
|
||||
|
||||
m. Fixed a bug that caused here documents to not be displayed correctly
|
||||
when attached to commands inside compound commands.
|
||||
|
||||
n. Fixed a bug that caused the printf builtin to use the wrong precision
|
||||
when using the `*' modifier.
|
||||
|
||||
o. Fixed a bug that caused an arriving SIGCHLD to interrupt output functions
|
||||
like those invoked by echo or printf.
|
||||
|
||||
p. Changed to use a more robust mechanism than eaccess(2) when test is
|
||||
checking filenames for execution permission.
|
||||
|
||||
q. Fixed a bug that caused spurious semicolons to be added into the command
|
||||
history in certain cases.
|
||||
|
||||
r. Fixed a bug that caused the shell to free non-allocated memory when
|
||||
unsetting element 0 of an associative array after it was assigned
|
||||
implicitly.
|
||||
|
||||
s. Fixed a bug that could cause the shell to dump core if using the `v'
|
||||
vi editing command on a multi-line command.
|
||||
|
||||
t. Fixed a bug that left FIFOs opened by process substitutions open long
|
||||
enough to potentially cause file descriptor exhaustion when running a
|
||||
shell function or shell builtin.
|
||||
|
||||
u. Fixed a bug that caused the history expansion functions to not recognize
|
||||
process substitution or extended glob patterns as single words.
|
||||
|
||||
v. Fixed a bug that caused restricted shells to set a restricted command's
|
||||
exit status incorrectly.
|
||||
|
||||
w. Fixed a bug that caused bash to ignore the wrong set of filenames when
|
||||
completing a command using the `complete-filename' readline command.
|
||||
|
||||
x. Fixed a bug that caused a -PID argument following a -s sig or -n sig to
|
||||
not be interpreted as a signal specification.
|
||||
|
||||
y. Changed posix-mode behavior of a parse error in a `.' script or `eval'
|
||||
command to exit the shell under Posix-specified conditions. Previous
|
||||
versions printed a warning.
|
||||
|
||||
z. Fixed a bug in \W prompt expansion that resulted in incorrect expansion
|
||||
in the event of overlapping strings.
|
||||
|
||||
aa. Fixed a bug that caused the := parameter expansion operator to return the
|
||||
wrong value as the result of the expansion.
|
||||
|
||||
bb. When in Posix mode, a single quote is not treated specially in a
|
||||
double-quoted ${...} expansion, unless the expansion operator is
|
||||
# or % or the non-Posix `//', `^', and `,'. In particular, it does
|
||||
not define a new quoting context. This is from Posix interpretation 221.
|
||||
|
||||
cc. Fixed a bug that inadvertently allowed program names containing slashes
|
||||
to be entered into the command hash table.
|
||||
|
||||
dd. Fixed a bug that caused the select builtin to incorrectly compute the
|
||||
display width of the arguments in the presence of multibyte characters.
|
||||
|
||||
ee. Fixed a bug that caused bash to not change the xtrace file descriptor if
|
||||
BASH_XTRACEFD was found in the shell environment at startup.
|
||||
|
||||
ff. Fixed a memory leak in the pattern removal parameter expansion.
|
||||
|
||||
gg. Fixed a bug that caused SIGINT to fail to interrupt a nested loop if the
|
||||
loop was in a pipeline.
|
||||
|
||||
hh. Fixed a problem in $(...) parsing that caused the parser to add an extra
|
||||
space to a here-document delimiter if the first word contained a `/'.
|
||||
|
||||
ii. Fixed a bug that caused functions defined with the `function' reserved
|
||||
word to require braces around the function body.
|
||||
|
||||
jj. Fixed a bug that caused bash to dump core when a variable expansion being
|
||||
used as an array subscript failed.
|
||||
|
||||
kk. Fixed a bug that caused bash to dump core if the case-modification
|
||||
expansions were used on a variable with a null value.
|
||||
|
||||
ll. Fixed a bug that caused partially-quoted strings to be split incorrectly
|
||||
if a variable with a null value was expanded within double quotes.
|
||||
|
||||
mm. The pattern substitution word expansion has been sped up dramatically
|
||||
when running in a locale with multibyte characters.
|
||||
|
||||
nn. Fixed a bug that caused history -a to not write the correct lines to
|
||||
the history file if all the new lines in the history list were added
|
||||
since the last time the history file was read or written.
|
||||
|
||||
oo. Fixed a bug that caused completion of a word with an unclosed `` command
|
||||
substitution to set the prompt incorrectly.
|
||||
|
||||
pp. Fixed a bug that caused extended globbing patterns in $HISTIGNORE or
|
||||
$GLOBIGNORE to be incorrectly scanned.
|
||||
|
||||
qq. Fixed a bug caused by closing file descriptors 3-20 on shell startup. The
|
||||
shell now sets them to close-on-exec.
|
||||
|
||||
rr. Fixed a bug that caused the exit status of `exec file' to be set incorrectly
|
||||
if `file' was a directory.
|
||||
|
||||
ss. Fixed a bug in the `.' builtin to make a non-interactive posix-mode shell
|
||||
exit if the file argument to `.' is not found. Prefixing exec with
|
||||
`command' makes the shell not exit. Posix requires this behavior.
|
||||
|
||||
tt. Fixed a bug that caused `sh -c 'command exec; exit 1' to hang.
|
||||
|
||||
uu. Fixed a bug in $(...) command substitution parsing that caused the shell
|
||||
to treat backslash-newline incorrectly when parsing a comment.
|
||||
|
||||
vv. Fixed bug that caused brace expansion sequence generation to misbehave
|
||||
when supplied integers greater than 2**31 - 1.
|
||||
|
||||
ww. Fixed a bug that caused failure to save file descriptors for redirections
|
||||
to corrupt shell file descriptors.
|
||||
|
||||
xx. Fixed a bug that caused bash-forward-shellword to not correctly handle
|
||||
quoted strings.
|
||||
|
||||
2. Changes to Readline
|
||||
|
||||
a. Fixed a bug that caused the unconverted filename to be added to the list of
|
||||
completions when the application specified filename conversion functions.
|
||||
|
||||
b. Fixed a bug that caused the wrong filename to be passed to opendir when the
|
||||
application has specified a filename dequoting function.
|
||||
|
||||
c. Fixed a bug when repeating a character search in vi mode in the case where
|
||||
there was no search to repeat.
|
||||
|
||||
d. When show-all-if-ambiguous is set, the completion routines no longer insert
|
||||
a common match prefix that is shorter than the text being completed.
|
||||
|
||||
e. The full set of vi editing commands may now be used in callback mode.
|
||||
|
||||
f. Fixed a bug that caused readline to not update its idea of the terminal
|
||||
dimensions while running in `no-echo' mode.
|
||||
|
||||
h. Fixed a bug that caused readline to dump core if an application called
|
||||
rl_prep_terminal without setting rl_instream.
|
||||
|
||||
i. Fixed a bug that caused meta-prefixed characters bound to incremental
|
||||
search forward or backward to not be recognized if they were typed
|
||||
subsequently.
|
||||
|
||||
j. The incremental search code treats key sequences that map to the same
|
||||
functions as (default) ^G, ^W, and ^Y as equivalent to those characters.
|
||||
|
||||
k. Fixed a bug in menu-complete that caused it to misbehave with large
|
||||
negative argument.
|
||||
|
||||
l. Fixed a bug that caused vi-mode yank-last-arg to ring the bell when invoked
|
||||
at the end of the line.
|
||||
|
||||
3. New Features in Bash
|
||||
|
||||
a. `exec -a foo' now sets $0 to `foo' in an executable shell script without a
|
||||
leading #!.
|
||||
|
||||
b. Subshells begun to execute command substitutions or run shell functions or
|
||||
builtins in subshells do not reset trap strings until a new trap is
|
||||
specified. This allows $(trap) to display the caller's traps and the
|
||||
trap strings to persist until a new trap is set.
|
||||
|
||||
c. `trap -p' will now show signals ignored at shell startup, though their
|
||||
disposition still cannot be modified.
|
||||
|
||||
d. $'...', echo, and printf understand \uXXXX and \UXXXXXXXX escape sequences.
|
||||
|
||||
e. declare/typeset has a new `-g' option, which creates variables in the
|
||||
global scope even when run in a shell function.
|
||||
|
||||
f. test/[/[[ have a new -v variable unary operator, which returns success if
|
||||
`variable' has been set.
|
||||
|
||||
g. Posix parsing changes to allow `! time command' and multiple consecutive
|
||||
instances of `!' (which toggle) and `time' (which have no cumulative
|
||||
effect).
|
||||
|
||||
h. Posix change to allow `time' as a command by itself to print the elapsed
|
||||
user, system, and real times for the shell and its children.
|
||||
|
||||
j. $((...)) is always parsed as an arithmetic expansion first, instead of as
|
||||
a potential nested command substitution, as Posix requires.
|
||||
|
||||
k. A new FUNCNEST variable to allow the user to control the maximum shell
|
||||
function nesting (recursive execution) level.
|
||||
|
||||
l. The mapfile builtin now supplies a third argument to the callback command:
|
||||
the line about to be assigned to the supplied array index.
|
||||
|
||||
m. The printf builtin has as new %(fmt)T specifier, which allows time values
|
||||
to use strftime-like formatting.
|
||||
|
||||
n. There is a new `compat41' shell option.
|
||||
|
||||
o. The cd builtin has a new Posix-mandated `-e' option.
|
||||
|
||||
p. Negative subscripts to indexed arrays, previously errors, now are treated
|
||||
as offsets from the maximum assigned index + 1.
|
||||
|
||||
q. Negative length specifications in the ${var:offset:length} expansion,
|
||||
previously errors, are now treated as offsets from the end of the variable.
|
||||
|
||||
r. Parsing change to allow `time -p --'.
|
||||
|
||||
s. Posix-mode parsing change to not recognize `time' as a keyword if the
|
||||
following token begins with a `-'. This means no more Posix-mode
|
||||
`time -p'. Posix interpretation 267.
|
||||
|
||||
t. There is a new `lastpipe' shell option that runs the last command of a
|
||||
pipeline in the current shell context. The lastpipe option has no
|
||||
effect if job control is enabled.
|
||||
|
||||
u. History expansion no longer expands the `$!' variable expansion.
|
||||
|
||||
v. Posix mode shells no longer exit if a variable assignment error occurs
|
||||
with an assignment preceding a command that is not a special builtin.
|
||||
|
||||
w. Non-interactive mode shells exit if -u is enabled an an attempt is made
|
||||
to use an unset variable with the % or # expansions, the `//', `^', or
|
||||
`,' expansions, or the parameter length expansion.
|
||||
|
||||
x. Posix-mode shells use the argument passed to `.' as-is if a $PATH search
|
||||
fails, effectively searching the current directory. Posix-2008 change.
|
||||
|
||||
4. New Features in Readline
|
||||
|
||||
a. The history library does not try to write the history filename in the
|
||||
current directory if $HOME is unset. This closes a potential security
|
||||
problem if the application does not specify a history filename.
|
||||
|
||||
b. New bindable variable `completion-display-width' to set the number of
|
||||
columns used when displaying completions.
|
||||
|
||||
c. New bindable variable `completion-case-map' to cause case-insensitive
|
||||
completion to treat `-' and `_' as identical.
|
||||
|
||||
d. There are new bindable vi-mode command names to avoid readline's case-
|
||||
insensitive matching not allowing them to be bound separately.
|
||||
|
||||
e. New bindable variable `menu-complete-display-prefix' causes the menu
|
||||
completion code to display the common prefix of the possible completions
|
||||
before cycling through the list, instead of after.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
This document details the changes between this version, bash-4.1-rc,
|
||||
and the previous version, bash-4.1-beta.
|
||||
|
||||
|
||||
@@ -332,6 +332,20 @@ version and versions 2.0 and above.
|
||||
> operators to the `[[' command. This can be reverted to the previous
|
||||
behavior by setting one of the `compatNN' shopt options.
|
||||
|
||||
45. Command substitutions now remove the caller's trap strings when trap is
|
||||
run to set a new trap in the subshell. Previous to bash-4.2, the old
|
||||
trap strings persisted even though the actual signal handlers were reset.
|
||||
|
||||
46. When in Posix mode, a single quote is not treated specially in a
|
||||
double-quoted ${...} expansion, unless the expansion operator is
|
||||
# or % or the new `//', `^', or `,' expansions. In particular, it
|
||||
does not define a new quoting context. This is from Posix interpretation
|
||||
221.
|
||||
|
||||
47. Posix mode shells no longer exit if a variable assignment error occurs
|
||||
with an assignment preceding a command that is not a special builtin.
|
||||
|
||||
|
||||
Shell Compatibility Level
|
||||
=========================
|
||||
|
||||
|
||||
@@ -360,6 +360,13 @@ compat40 set
|
||||
of the entire list to be aborted (in versions before bash-4.0,
|
||||
interrupting one command in a list caused the next to be executed)
|
||||
|
||||
compat41 set
|
||||
- interrupting a command list such as "a ; b ; c" causes the execution
|
||||
of the entire list to be aborted (in versions before bash-4.0,
|
||||
interrupting one command in a list caused the next to be executed)
|
||||
- when in posix mode, single quotes in the `word' portion of a
|
||||
double-quoted parameter expansion define a new quoting context and
|
||||
are treated specially
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Copying and distribution of this file, with or without modification,
|
||||
|
||||
+109
-1
@@ -9838,7 +9838,7 @@ doc/{bash.1,bashref.texi}
|
||||
execute_cmd.c
|
||||
- change execute_disk_command to return a status, instead of just
|
||||
leaving it in `last_command_exit_value', since the parent's return
|
||||
value is sometimes uses (e.g., when a restricted shell refuses to
|
||||
value is sometimes used (e.g., when a restricted shell refuses to
|
||||
run a command with a `/'). Fixes bug reported by David Pitt
|
||||
<David.Pitt@anz.com>
|
||||
|
||||
@@ -10474,3 +10474,111 @@ execute_cmd.c
|
||||
saved_redirects is non-null in the `command exec' case. Fixes
|
||||
sh -c 'command exec; exit 1' hanging bug uncovered by FreeBSD
|
||||
sh test cases
|
||||
|
||||
10/18
|
||||
-----
|
||||
subst.c
|
||||
- when in posix mode, shell should not exit if a variable assignment
|
||||
error (e.g., assigning to readonly variable) occurs preceding a
|
||||
command that is not a special builtin. Fixes bug uncovered by
|
||||
FreeBSD sh test cases
|
||||
- when in posix mode, the ${!?} and ${!#} expansions are not indirect
|
||||
expansions, but posix word expansions involving the `!' variable
|
||||
|
||||
parse.y
|
||||
- fix parse_comsub so that it does not skip backslash-newline when
|
||||
parsing a comment
|
||||
|
||||
10/19
|
||||
-----
|
||||
subst.c
|
||||
- fix parameter_brace_expand so that an attempt to use the % or #
|
||||
expansions on an unset variable with -u set will cause a non-
|
||||
interactive shell to abort. Posix change
|
||||
- fix parameter_brace_expand so that an attempt to use pattern
|
||||
substitution or case modification expansions on an unset variable
|
||||
with -u set will cause and unbound variable error and make a
|
||||
non-interactive shell abort
|
||||
- change parameter_brace_expand_length to return INTMAX_MIN if a
|
||||
positional parameter is unset and -u is set
|
||||
- if parameter_brace_expand_length returns INTMAX_MIN when -u is set,
|
||||
treat it as an unbound variable error and make a non-interactive
|
||||
shell abort. Posix change
|
||||
- change parameter_brace_expand_length to return INTMAX_MIN if an
|
||||
implicit reference to array[0] is made ${#array} and array[0] is
|
||||
not set when -u is set
|
||||
|
||||
10/20
|
||||
-----
|
||||
builtins/cd.def
|
||||
- Posix 2008 says that if no matching directories are found in $CDPATH,
|
||||
use the directory name passed as an operand and go on. Posix change
|
||||
|
||||
doc/bashref.texi
|
||||
- change Posix mode section with latest additions and removals
|
||||
|
||||
11/4
|
||||
----
|
||||
lib/readline/complete.c
|
||||
- fix rl_menu_complete and rl_old_menu_complete to keep incrementing
|
||||
match_list_index by match_list_size as long as it's < 0. Fixes
|
||||
bug reported by jeenuv@gmail.com
|
||||
|
||||
braces.c
|
||||
- make mkseq() take intmax_t arguments for sequence start and end
|
||||
and make sure it's passed intmax_t values. Fixes bug reported by
|
||||
Pete Gregory <pg@bushlitt.org>
|
||||
|
||||
sig.c
|
||||
- if termsig_handler is called when terminate_immediately == 1,
|
||||
assume we're being called as a signal handler and set
|
||||
history_lines_this_session to 0 to inhibit history file being
|
||||
written on shell exit. Fixes long-standing bug most recently
|
||||
observed by Andreas Schwab <schwab@linux-m68k.org>
|
||||
|
||||
11/5
|
||||
----
|
||||
redir.c
|
||||
- add_undo_close_redirect now returns int, 0 on success, non-zero on
|
||||
failure. Currently always succeeds
|
||||
- new macro REDIRECTION_ERROR to make do_redirection_internal return
|
||||
value of errno
|
||||
- change do_redirection_internal to call REDIRECTION_ERROR after
|
||||
saving file descriptor and make do_redirection_internal return error
|
||||
if add_undo_redirect or add_undo_close redirect fails. This makes
|
||||
failure to save a file descriptor a redirection error and the shell
|
||||
behaves appropriately. Fixes bug reported by Eric Blake
|
||||
<eblake@redhat.com>
|
||||
|
||||
bashline.c
|
||||
- modify bash_forward_shellword to correctly handle quoted strings,
|
||||
especially if point is in a quoted string when function is invoked.
|
||||
Fixes bug reported by Daniel Colascione <dan.colascione@gmail.com>
|
||||
|
||||
configure.in
|
||||
- change version to 4.2-alpha
|
||||
|
||||
11/7
|
||||
----
|
||||
lib/readline/text.c
|
||||
- in rl_insert, if we're not in the multibyte code path, don't try to
|
||||
optimize and insert all of the available typeahead input if we're
|
||||
reading input from a macro. Fixes bug reported by Andre Majorel
|
||||
<aym-ung@teaser.fr>
|
||||
|
||||
lib/readline/text.c
|
||||
- break out multibyte guts of rl_forward_char into a separate function
|
||||
_rl_forward_char_internal that does nothing but calculate the new
|
||||
value of point
|
||||
- change rl_forward_char to call _rl_forward_char_internal instead of
|
||||
having equivalent code inline
|
||||
|
||||
lib/readline/rlprivate.h
|
||||
- new extern declaration for _rl_forward_char_internal
|
||||
|
||||
lib/readline/vi_mode.c
|
||||
- change _rl_vi_append_forward to call _rl_forward_char_internal to
|
||||
set rl_point, instead of calling rl_forward_char. When at the end
|
||||
of the line, rl_forward_char will ring the bell. Fixes debian
|
||||
bash bug 601042, reported by Alan J. Greenberger <alanjg@ptd.net>
|
||||
|
||||
|
||||
+68
-1
@@ -9838,7 +9838,7 @@ doc/{bash.1,bashref.texi}
|
||||
execute_cmd.c
|
||||
- change execute_disk_command to return a status, instead of just
|
||||
leaving it in `last_command_exit_value', since the parent's return
|
||||
value is sometimes uses (e.g., when a restricted shell refuses to
|
||||
value is sometimes used (e.g., when a restricted shell refuses to
|
||||
run a command with a `/'). Fixes bug reported by David Pitt
|
||||
<David.Pitt@anz.com>
|
||||
|
||||
@@ -10513,3 +10513,70 @@ subst.c
|
||||
builtins/cd.def
|
||||
- Posix 2008 says that if no matching directories are found in $CDPATH,
|
||||
use the directory name passed as an operand and go on. Posix change
|
||||
|
||||
doc/bashref.texi
|
||||
- change Posix mode section with latest additions and removals
|
||||
|
||||
11/4
|
||||
----
|
||||
lib/readline/complete.c
|
||||
- fix rl_menu_complete and rl_old_menu_complete to keep incrementing
|
||||
match_list_index by match_list_size as long as it's < 0. Fixes
|
||||
bug reported by jeenuv@gmail.com
|
||||
|
||||
braces.c
|
||||
- make mkseq() take intmax_t arguments for sequence start and end
|
||||
and make sure it's passed intmax_t values. Fixes bug reported by
|
||||
Pete Gregory <pg@bushlitt.org>
|
||||
|
||||
sig.c
|
||||
- if termsig_handler is called when terminate_immediately == 1,
|
||||
assume we're being called as a signal handler and set
|
||||
history_lines_this_session to 0 to inhibit history file being
|
||||
written on shell exit. Fixes long-standing bug most recently
|
||||
observed by Andreas Schwab <schwab@linux-m68k.org>
|
||||
|
||||
11/5
|
||||
----
|
||||
redir.c
|
||||
- add_undo_close_redirect now returns int, 0 on success, non-zero on
|
||||
failure. Currently always succeeds
|
||||
- new macro REDIRECTION_ERROR to make do_redirection_internal return
|
||||
value of errno
|
||||
- change do_redirection_internal to call REDIRECTION_ERROR after
|
||||
saving file descriptor and make do_redirection_internal return error
|
||||
if add_undo_redirect or add_undo_close redirect fails. This makes
|
||||
failure to save a file descriptor a redirection error and the shell
|
||||
behaves appropriately. Fixes bug reported by Eric Blake
|
||||
<eblake@redhat.com>
|
||||
|
||||
bashline.c
|
||||
- modify bash_forward_shellword to correctly handle quoted strings,
|
||||
especially if point is in a quoted string when function is invoked.
|
||||
Fixes bug reported by Daniel Colascione <dan.colascione@gmail.com>
|
||||
|
||||
configure.in
|
||||
- change version to 4.2-alpha
|
||||
|
||||
11/7
|
||||
----
|
||||
lib/readline/text.c
|
||||
- in rl_insert, if we're not in the multibyte code path, don't try to
|
||||
optimize and insert all of the available typeahead input if we're
|
||||
reading input from a macro. Fixes bug reported by Andre Majorel
|
||||
<aym-ung@teaser.fr>
|
||||
- break out multibyte guts of rl_forward_char into a separate function
|
||||
_rl_forward_char_internal that does nothing but calculate the new
|
||||
value of point
|
||||
- change rl_forward_char to call _rl_forward_char_internal instead of
|
||||
having equivalent code inline
|
||||
|
||||
lib/readline/rlprivate.h
|
||||
- new extern declaration for _rl_forward_char_internal
|
||||
|
||||
lib/readline/vi_mode.c
|
||||
- change _rl_vi_append_forward to call _rl_forward_char_internal to
|
||||
set rl_point, instead of calling rl_forward_char. When at the end
|
||||
of the line, rl_forward_char will ring the bell. Fixes debian
|
||||
bash bug 601042, reported by Alan J. Greenberger <alanjg@ptd.net>
|
||||
|
||||
|
||||
@@ -948,6 +948,10 @@ tests/posix2.tests f
|
||||
tests/posix2.right f
|
||||
tests/posixexp.tests f
|
||||
tests/posixexp.right f
|
||||
tests/posixexp1.sub f
|
||||
tests/posixexp2.sub f
|
||||
tests/posixexp2.tests f
|
||||
tests/posixexp2.right f
|
||||
tests/posixpat.tests f
|
||||
tests/posixpat.right f
|
||||
tests/posixpipe.tests f
|
||||
@@ -1043,6 +1047,7 @@ tests/run-nquote4 f
|
||||
tests/run-nquote5 f
|
||||
tests/run-posix2 f
|
||||
tests/run-posixexp f
|
||||
tests/run-posixexp2 f
|
||||
tests/run-posixpat f
|
||||
tests/run-posixpipe f
|
||||
tests/run-precedence f
|
||||
|
||||
@@ -929,6 +929,7 @@ tests/new-exp4.sub f
|
||||
tests/new-exp5.sub f
|
||||
tests/new-exp6.sub f
|
||||
tests/new-exp7.sub f
|
||||
tests/new-exp8.sub f
|
||||
tests/new-exp.right f
|
||||
tests/nquote.tests f
|
||||
tests/nquote.right f
|
||||
@@ -947,6 +948,8 @@ tests/posix2.tests f
|
||||
tests/posix2.right f
|
||||
tests/posixexp.tests f
|
||||
tests/posixexp.right f
|
||||
tests/posixexp1.sub f
|
||||
tests/posixexp2.sub f
|
||||
tests/posixpat.tests f
|
||||
tests/posixpat.right f
|
||||
tests/posixpipe.tests f
|
||||
|
||||
@@ -1,3 +1,99 @@
|
||||
This is a terse description of the new features added to bash-4.2 since
|
||||
the release of bash-4.1. As always, the manual page (doc/bash.1) is
|
||||
the place to look for complete descriptions.
|
||||
|
||||
1. New Features in Bash
|
||||
|
||||
a. `exec -a foo' now sets $0 to `foo' in an executable shell script without a
|
||||
leading #!.
|
||||
|
||||
b. Subshells begun to execute command substitutions or run shell functions or
|
||||
builtins in subshells do not reset trap strings until a new trap is
|
||||
specified. This allows $(trap) to display the caller's traps and the
|
||||
trap strings to persist until a new trap is set.
|
||||
|
||||
c. `trap -p' will now show signals ignored at shell startup, though their
|
||||
disposition still cannot be modified.
|
||||
|
||||
d. $'...', echo, and printf understand \uXXXX and \UXXXXXXXX escape sequences.
|
||||
|
||||
e. declare/typeset has a new `-g' option, which creates variables in the
|
||||
global scope even when run in a shell function.
|
||||
|
||||
f. test/[/[[ have a new -v variable unary operator, which returns success if
|
||||
`variable' has been set.
|
||||
|
||||
g. Posix parsing changes to allow `! time command' and multiple consecutive
|
||||
instances of `!' (which toggle) and `time' (which have no cumulative
|
||||
effect).
|
||||
|
||||
h. Posix change to allow `time' as a command by itself to print the elapsed
|
||||
user, system, and real times for the shell and its children.
|
||||
|
||||
j. $((...)) is always parsed as an arithmetic expansion first, instead of as
|
||||
a potential nested command substitution, as Posix requires.
|
||||
|
||||
k. A new FUNCNEST variable to allow the user to control the maximum shell
|
||||
function nesting (recursive execution) level.
|
||||
|
||||
l. The mapfile builtin now supplies a third argument to the callback command:
|
||||
the line about to be assigned to the supplied array index.
|
||||
|
||||
m. The printf builtin has as new %(fmt)T specifier, which allows time values
|
||||
to use strftime-like formatting.
|
||||
|
||||
n. There is a new `compat41' shell option.
|
||||
|
||||
o. The cd builtin has a new Posix-mandated `-e' option.
|
||||
|
||||
p. Negative subscripts to indexed arrays, previously errors, now are treated
|
||||
as offsets from the maximum assigned index + 1.
|
||||
|
||||
q. Negative length specifications in the ${var:offset:length} expansion,
|
||||
previously errors, are now treated as offsets from the end of the variable.
|
||||
|
||||
r. Parsing change to allow `time -p --'.
|
||||
|
||||
s. Posix-mode parsing change to not recognize `time' as a keyword if the
|
||||
following token begins with a `-'. This means no more Posix-mode
|
||||
`time -p'. Posix interpretation 267.
|
||||
|
||||
t. There is a new `lastpipe' shell option that runs the last command of a
|
||||
pipeline in the current shell context. The lastpipe option has no
|
||||
effect if job control is enabled.
|
||||
|
||||
u. History expansion no longer expands the `$!' variable expansion.
|
||||
|
||||
v. Posix mode shells no longer exit if a variable assignment error occurs
|
||||
with an assignment preceding a command that is not a special builtin.
|
||||
|
||||
w. Non-interactive mode shells exit if -u is enabled an an attempt is made
|
||||
to use an unset variable with the % or # expansions, the `//', `^', or
|
||||
`,' expansions, or the parameter length expansion.
|
||||
|
||||
x. Posix-mode shells use the argument passed to `.' as-is if a $PATH search
|
||||
fails, effectively searching the current directory. Posix-2008 change.
|
||||
|
||||
2. New Features in Readline
|
||||
|
||||
a. The history library does not try to write the history filename in the
|
||||
current directory if $HOME is unset. This closes a potential security
|
||||
problem if the application does not specify a history filename.
|
||||
|
||||
b. New bindable variable `completion-display-width' to set the number of
|
||||
columns used when displaying completions.
|
||||
|
||||
c. New bindable variable `completion-case-map' to cause case-insensitive
|
||||
completion to treat `-' and `_' as identical.
|
||||
|
||||
d. There are new bindable vi-mode command names to avoid readline's case-
|
||||
insensitive matching not allowing them to be bound separately.
|
||||
|
||||
e. New bindable variable `menu-complete-display-prefix' causes the menu
|
||||
completion code to display the common prefix of the possible completions
|
||||
before cycling through the list, instead of after.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
This is a terse description of the new features added to bash-4.1 since
|
||||
the release of bash-4.0. As always, the manual page (doc/bash.1) is
|
||||
the place to look for complete descriptions.
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
|
||||
1. New Features in Bash
|
||||
|
||||
a. `exec -a foo' now sets $0 to `foo' in an executable shell script without a
|
||||
leading #!.
|
||||
|
||||
b. Subshells begun to execute command substitutions or run shell functions or
|
||||
builtins in subshells do not reset trap strings until a new trap is
|
||||
specified. This allows $(trap) to display the caller's traps and the
|
||||
trap strings to persist until a new trap is set.
|
||||
|
||||
c. `trap -p' will now show signals ignored at shell startup, though their
|
||||
disposition still cannot be modified.
|
||||
|
||||
d. $'...', echo, and printf understand \uXXXX and \UXXXXXXXX escape sequences.
|
||||
|
||||
e. declare/typeset has a new `-g' option, which creates variables in the
|
||||
global scope even when run in a shell function.
|
||||
|
||||
f. test/[/[[ have a new -v variable unary operator, which returns success if
|
||||
`variable' has been set.
|
||||
|
||||
g. Posix parsing changes to allow `! time command' and multiple consecutive
|
||||
instances of `!' (which toggle) and `time' (which have no cumulative
|
||||
effect).
|
||||
|
||||
h. Posix change to allow `time' as a command by itself to print the elapsed
|
||||
user, system, and real times for the shell and its children.
|
||||
|
||||
j. $((...)) is always parsed as an arithmetic expansion first, instead of as
|
||||
a potential nested command substitution, as Posix requires.
|
||||
|
||||
k. A new FUNCNEST variable to allow the user to control the maximum shell
|
||||
function nesting (recursive execution) level.
|
||||
|
||||
l. The mapfile builtin now supplies a third argument to the callback command:
|
||||
the line about to be assigned to the supplied array index.
|
||||
|
||||
m. The printf builtin has as new %(fmt)T specifier, which allows time values
|
||||
to use strftime-like formatting.
|
||||
|
||||
n. There is a new `compat41' shell option.
|
||||
|
||||
o. The cd builtin has a new Posix-mandated `-e' option.
|
||||
|
||||
p. Negative subscripts to indexed arrays, previously errors, now are treated
|
||||
as offsets from the maximum assigned index + 1.
|
||||
|
||||
q. Negative length specifications in the ${var:offset:length} expansion,
|
||||
previously errors, are now treated as offsets from the end of the variable.
|
||||
|
||||
r. Parsing change to allow `time -p --'.
|
||||
|
||||
s. Posix-mode parsing change to not recognize `time' as a keyword if the
|
||||
following token begins with a `-'. This means no more Posix-mode
|
||||
`time -p'. Posix interpretation 267.
|
||||
|
||||
t. There is a new `lastpipe' shell option that runs the last command of a
|
||||
pipeline in the current shell context. The lastpipe option has no
|
||||
effect if job control is enabled.
|
||||
|
||||
u. History expansion no longer expands the `$!' variable expansion.
|
||||
|
||||
v. Posix mode shells no longer exit if a variable assignment error occurs
|
||||
with an assignment preceding a command that is not a special builtin.
|
||||
|
||||
w. Non-interactive mode shells exit if -u is enabled an an attempt is made
|
||||
to use an unset variable with the % or # expansions, the `//', `^', or
|
||||
`,' expansions, or the parameter length expansion.
|
||||
|
||||
x. Posix-mode shells use the argument passed to `.' as-is if a $PATH search
|
||||
fails, effectively searching the current directory. Posix-2008 change.
|
||||
|
||||
2. New Features in Readline
|
||||
|
||||
a. The history library does not try to write the history filename in the
|
||||
current directory if $HOME is unset. This closes a potential security
|
||||
problem if the application does not specify a history filename.
|
||||
|
||||
b. New bindable variable `completion-display-width' to set the number of
|
||||
columns used when displaying completions.
|
||||
|
||||
c. New bindable variable `completion-case-map' to cause case-insensitive
|
||||
completion to treat `-' and `_' as identical.
|
||||
|
||||
d. There are new bindable vi-mode command names to avoid readline's case-
|
||||
insensitive matching not allowing them to be bound separately.
|
||||
|
||||
e. New bindable variable `menu-complete-display-prefix' causes the menu
|
||||
completion code to display the common prefix of the possible completions
|
||||
before cycling through the list, instead of after.
|
||||
@@ -1,8 +1,8 @@
|
||||
Introduction
|
||||
============
|
||||
|
||||
This is GNU Bash, version 4.1. Bash is the GNU Project's Bourne
|
||||
Again SHell, a complete implementation of the POSIX.2 shell spec,
|
||||
This is GNU Bash, version 4.2. Bash is the GNU Project's Bourne
|
||||
Again SHell, a complete implementation of the POSIX shell spec,
|
||||
but also with interactive command line editing, job control on
|
||||
architectures that support it, csh-like features such as history
|
||||
substitution and brace expansion, and a slew of other features.
|
||||
@@ -12,11 +12,11 @@ large Unix-style man page. The man page is the definitive description
|
||||
of the shell's features.
|
||||
|
||||
See the file POSIX for a discussion of how the Bash defaults differ
|
||||
from the POSIX.2 spec and a description of the Bash `posix mode'.
|
||||
from the POSIX spec and a description of the Bash `posix mode'.
|
||||
|
||||
There are some user-visible incompatibilities between this version
|
||||
of Bash and previous widely-distributed versions, bash-3.2 and
|
||||
bash-4.0. For details, see the file COMPAT. The NEWS file tersely
|
||||
of Bash and previous widely-distributed versions, bash-4.0 and
|
||||
bash-4.1. For details, see the file COMPAT. The NEWS file tersely
|
||||
lists features that are new in this release.
|
||||
|
||||
Bash is free software, distributed under the terms of the [GNU] General
|
||||
@@ -27,10 +27,10 @@ see the file COPYING.
|
||||
A number of frequently-asked questions are answered in the file
|
||||
`doc/FAQ'.
|
||||
|
||||
To compile Bash, try typing `./configure', then `make'. Bash
|
||||
auto-configures the build process, so no further intervention
|
||||
should be necessary. Bash builds with `gcc' by default if it is
|
||||
available. If you want to use `cc' instead, type
|
||||
To compile Bash, type `./configure', then `make'. Bash auto-configures
|
||||
the build process, so no further intervention should be necessary. Bash
|
||||
builds with `gcc' by default if it is available. If you want to use `cc'
|
||||
instead, type
|
||||
|
||||
CC=cc ./configure
|
||||
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
Introduction
|
||||
============
|
||||
|
||||
This is GNU Bash, version 4.1. Bash is the GNU Project's Bourne
|
||||
Again SHell, a complete implementation of the POSIX.2 shell spec,
|
||||
but also with interactive command line editing, job control on
|
||||
architectures that support it, csh-like features such as history
|
||||
substitution and brace expansion, and a slew of other features.
|
||||
For more information on the features of Bash that are new to this
|
||||
type of shell, see the file `doc/bashref.texi'. There is also a
|
||||
large Unix-style man page. The man page is the definitive description
|
||||
of the shell's features.
|
||||
|
||||
See the file POSIX for a discussion of how the Bash defaults differ
|
||||
from the POSIX.2 spec and a description of the Bash `posix mode'.
|
||||
|
||||
There are some user-visible incompatibilities between this version
|
||||
of Bash and previous widely-distributed versions, bash-3.2 and
|
||||
bash-4.0. For details, see the file COMPAT. The NEWS file tersely
|
||||
lists features that are new in this release.
|
||||
|
||||
Bash is free software, distributed under the terms of the [GNU] General
|
||||
Public License as published by the Free Software Foundation,
|
||||
version 3 of the License (or any later version). For more information,
|
||||
see the file COPYING.
|
||||
|
||||
A number of frequently-asked questions are answered in the file
|
||||
`doc/FAQ'.
|
||||
|
||||
To compile Bash, try typing `./configure', then `make'. Bash
|
||||
auto-configures the build process, so no further intervention
|
||||
should be necessary. Bash builds with `gcc' by default if it is
|
||||
available. If you want to use `cc' instead, type
|
||||
|
||||
CC=cc ./configure
|
||||
|
||||
if you are using a Bourne-style shell. If you are not, the following
|
||||
may work:
|
||||
|
||||
env CC=cc ./configure
|
||||
|
||||
Read the file INSTALL in this directory for more information about how
|
||||
to customize and control the build process. The file NOTES contains
|
||||
platform-specific installation and configuration information.
|
||||
|
||||
If you are a csh user and wish to convert your csh aliases to Bash
|
||||
aliases, you may wish to use the script `examples/misc/alias-conv.sh'
|
||||
as a starting point. The script `examples/misc/cshtobash' is a
|
||||
more ambitious script that attempts to do a more complete job.
|
||||
|
||||
Reporting Bugs
|
||||
==============
|
||||
|
||||
Bug reports for bash should be sent to:
|
||||
|
||||
bug-bash@gnu.org
|
||||
|
||||
using the `bashbug' program that is built and installed at the same
|
||||
time as bash.
|
||||
|
||||
The discussion list `bug-bash@gnu.org' often contains information
|
||||
about new ports of Bash, or discussions of new features or behavior
|
||||
changes that people would like. This mailing list is also available
|
||||
as a usenet newsgroup: gnu.bash.bug.
|
||||
|
||||
When you send a bug report, please use the `bashbug' program that is
|
||||
built at the same time as bash. If bash fails to build, try building
|
||||
bashbug directly with `make bashbug'. If you cannot build `bashbug',
|
||||
please send mail to bug-bash@gnu.org with the following information:
|
||||
|
||||
* the version number and release status of Bash (e.g., 2.05a-release)
|
||||
* the machine and OS that it is running on (you may run
|
||||
`bashversion -l' from the bash build directory for this information)
|
||||
* a list of the compilation flags or the contents of `config.h', if
|
||||
appropriate
|
||||
* a description of the bug
|
||||
* a recipe for recreating the bug reliably
|
||||
* a fix for the bug if you have one!
|
||||
|
||||
The `bashbug' program includes much of this automatically.
|
||||
|
||||
If you would like to contact the Bash maintainers directly, send mail
|
||||
to bash-maintainers@gnu.org.
|
||||
|
||||
While the Bash maintainers do not promise to fix all bugs, we would
|
||||
like this shell to be the best that we can make it.
|
||||
|
||||
Enjoy!
|
||||
|
||||
Chet Ramey
|
||||
chet.ramey@case.edu
|
||||
|
||||
Copying and distribution of this file, with or without modification,
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
notice and this notice are preserved. This file is offered as-is,
|
||||
without any warranty.
|
||||
+10
-10
@@ -1,7 +1,7 @@
|
||||
@%:@! /bin/sh
|
||||
@%:@ From configure.in for Bash 4.2, version 4.033.
|
||||
@%:@ Guess values for system-dependent variables and create Makefiles.
|
||||
@%:@ Generated by GNU Autoconf 2.63 for bash 4.2-devel.
|
||||
@%:@ Generated by GNU Autoconf 2.63 for bash 4.2-alpha.
|
||||
@%:@
|
||||
@%:@ Report bugs to <bug-bash@gnu.org>.
|
||||
@%:@
|
||||
@@ -597,8 +597,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
|
||||
# Identity of this package.
|
||||
PACKAGE_NAME='bash'
|
||||
PACKAGE_TARNAME='bash'
|
||||
PACKAGE_VERSION='4.2-devel'
|
||||
PACKAGE_STRING='bash 4.2-devel'
|
||||
PACKAGE_VERSION='4.2-alpha'
|
||||
PACKAGE_STRING='bash 4.2-alpha'
|
||||
PACKAGE_BUGREPORT='bug-bash@gnu.org'
|
||||
|
||||
ac_unique_file="shell.h"
|
||||
@@ -1408,7 +1408,7 @@ if test "$ac_init_help" = "long"; then
|
||||
# Omit some internal or obsolete options to make the list less imposing.
|
||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||
cat <<_ACEOF
|
||||
\`configure' configures bash 4.2-devel to adapt to many kinds of systems.
|
||||
\`configure' configures bash 4.2-alpha to adapt to many kinds of systems.
|
||||
|
||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||
|
||||
@@ -1473,7 +1473,7 @@ fi
|
||||
|
||||
if test -n "$ac_init_help"; then
|
||||
case $ac_init_help in
|
||||
short | recursive ) echo "Configuration of bash 4.2-devel:";;
|
||||
short | recursive ) echo "Configuration of bash 4.2-alpha:";;
|
||||
esac
|
||||
cat <<\_ACEOF
|
||||
|
||||
@@ -1648,7 +1648,7 @@ fi
|
||||
test -n "$ac_init_help" && exit $ac_status
|
||||
if $ac_init_version; then
|
||||
cat <<\_ACEOF
|
||||
bash configure 4.2-devel
|
||||
bash configure 4.2-alpha
|
||||
generated by GNU Autoconf 2.63
|
||||
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
|
||||
@@ -1662,7 +1662,7 @@ cat >config.log <<_ACEOF
|
||||
This file contains any messages produced by compilers while
|
||||
running configure, to aid debugging if configure makes a mistake.
|
||||
|
||||
It was created by bash $as_me 4.2-devel, which was
|
||||
It was created by bash $as_me 4.2-alpha, which was
|
||||
generated by GNU Autoconf 2.63. Invocation command line was
|
||||
|
||||
$ $0 $@
|
||||
@@ -2076,7 +2076,7 @@ ac_config_headers="$ac_config_headers config.h"
|
||||
|
||||
|
||||
BASHVERS=4.2
|
||||
RELSTATUS=devel
|
||||
RELSTATUS=alpha
|
||||
|
||||
case "$RELSTATUS" in
|
||||
alp*|bet*|dev*|rc*|maint*) DEBUG='-DDEBUG' MALLOC_DEBUG='-DMALLOC_DEBUG' ;;
|
||||
@@ -31860,7 +31860,7 @@ exec 6>&1
|
||||
# report actual input values of CONFIG_FILES etc. instead of their
|
||||
# values after options handling.
|
||||
ac_log="
|
||||
This file was extended by bash $as_me 4.2-devel, which was
|
||||
This file was extended by bash $as_me 4.2-alpha, which was
|
||||
generated by GNU Autoconf 2.63. Invocation command line was
|
||||
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
@@ -31923,7 +31923,7 @@ Report bugs to <bug-autoconf@gnu.org>."
|
||||
_ACEOF
|
||||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||
ac_cs_version="\\
|
||||
bash config.status 4.2-devel
|
||||
bash config.status 4.2-alpha
|
||||
configured by $0, generated by GNU Autoconf 2.63,
|
||||
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
|
||||
|
||||
|
||||
+11
-11
@@ -15,25 +15,25 @@
|
||||
'configure.in'
|
||||
],
|
||||
{
|
||||
'AM_PROG_F77_C_O' => 1,
|
||||
'_LT_AC_TAGCONFIG' => 1,
|
||||
'm4_pattern_forbid' => 1,
|
||||
'AM_PROG_F77_C_O' => 1,
|
||||
'AC_INIT' => 1,
|
||||
'AC_CANONICAL_TARGET' => 1,
|
||||
'm4_pattern_forbid' => 1,
|
||||
'_AM_COND_IF' => 1,
|
||||
'AC_CONFIG_LIBOBJ_DIR' => 1,
|
||||
'AC_CANONICAL_TARGET' => 1,
|
||||
'AC_SUBST' => 1,
|
||||
'AC_CANONICAL_HOST' => 1,
|
||||
'AC_CONFIG_LIBOBJ_DIR' => 1,
|
||||
'AC_FC_SRCEXT' => 1,
|
||||
'AC_CANONICAL_HOST' => 1,
|
||||
'AC_PROG_LIBTOOL' => 1,
|
||||
'AM_INIT_AUTOMAKE' => 1,
|
||||
'AC_CONFIG_SUBDIRS' => 1,
|
||||
'AM_AUTOMAKE_VERSION' => 1,
|
||||
'LT_CONFIG_LTDL_DIR' => 1,
|
||||
'AC_CONFIG_LINKS' => 1,
|
||||
'AC_REQUIRE_AUX_FILE' => 1,
|
||||
'LT_SUPPORTED_TAG' => 1,
|
||||
'AC_CONFIG_LINKS' => 1,
|
||||
'm4_sinclude' => 1,
|
||||
'LT_SUPPORTED_TAG' => 1,
|
||||
'AM_MAINTAINER_MODE' => 1,
|
||||
'AM_GNU_GETTEXT_INTL_SUBDIR' => 1,
|
||||
'_m4_warn' => 1,
|
||||
@@ -49,13 +49,13 @@
|
||||
'AC_CANONICAL_BUILD' => 1,
|
||||
'AC_FC_FREEFORM' => 1,
|
||||
'AH_OUTPUT' => 1,
|
||||
'AC_CONFIG_AUX_DIR' => 1,
|
||||
'_AM_SUBST_NOTMAKE' => 1,
|
||||
'AM_PROG_CC_C_O' => 1,
|
||||
'm4_pattern_allow' => 1,
|
||||
'AC_CONFIG_AUX_DIR' => 1,
|
||||
'sinclude' => 1,
|
||||
'AM_CONDITIONAL' => 1,
|
||||
'm4_pattern_allow' => 1,
|
||||
'AM_PROG_CC_C_O' => 1,
|
||||
'AC_CANONICAL_SYSTEM' => 1,
|
||||
'AM_CONDITIONAL' => 1,
|
||||
'AC_CONFIG_HEADERS' => 1,
|
||||
'AC_DEFINE_TRACE_LITERAL' => 1,
|
||||
'm4_include' => 1,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
m4trace:configure.in:29: -1- AC_INIT([bash], [4.2-devel], [bug-bash@gnu.org])
|
||||
m4trace:configure.in:29: -1- AC_INIT([bash], [4.2-alpha], [bug-bash@gnu.org])
|
||||
m4trace:configure.in:29: -1- m4_pattern_forbid([^_?A[CHUM]_])
|
||||
m4trace:configure.in:29: -1- m4_pattern_forbid([_AC_])
|
||||
m4trace:configure.in:29: -1- m4_pattern_forbid([^LIBOBJS$], [do not use LIBOBJS directly, use AC_LIBOBJ (see section `AC_LIBOBJ vs LIBOBJS'])
|
||||
|
||||
+14
@@ -993,6 +993,20 @@ bash_forward_shellword (count, key)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Are we in a quoted string? If we are, move to the end of the quoted
|
||||
string and continue the outer loop. We only want quoted strings, not
|
||||
backslash-escaped characters, but char_is_quoted doesn't
|
||||
differentiate. */
|
||||
if (char_is_quoted (rl_line_buffer, p) && p > 0 && rl_line_buffer[p-1] != '\\')
|
||||
{
|
||||
do
|
||||
ADVANCE_CHAR (rl_line_buffer, slen, p);
|
||||
while (p < rl_end && char_is_quoted (rl_line_buffer, p));
|
||||
count--;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Rest of code assumes we are not in a quoted string. */
|
||||
/* Move forward until we hit a non-metacharacter. */
|
||||
while (p < rl_end && (c = rl_line_buffer[p]) && WORDDELIM (c))
|
||||
{
|
||||
|
||||
+14
-2
@@ -993,6 +993,18 @@ bash_forward_shellword (count, key)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Are we in a quoted string? If we are, move to the end of the quoted
|
||||
string and continue the outer loop. */
|
||||
if (char_is_quoted (rl_line_buffer, p) && p > 0 && rl_line_buffer[p-1] != '\\')
|
||||
{
|
||||
do
|
||||
ADVANCE_CHAR (rl_line_buffer, slen, p);
|
||||
while (p < rl_end && char_is_quoted (rl_line_buffer, p));
|
||||
count--;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Rest of code assumes we are not in a quoted string. */
|
||||
/* Move forward until we hit a non-metacharacter. */
|
||||
while (p < rl_end && (c = rl_line_buffer[p]) && WORDDELIM (c))
|
||||
{
|
||||
@@ -1400,12 +1412,12 @@ bash_default_completion (text, start, end, qc, compflags)
|
||||
|
||||
/* If the word starts in `~', and there is no slash in the word, then
|
||||
try completing this word as a username. */
|
||||
if (matches ==0 && *text == '~' && mbschr (text, '/') == 0)
|
||||
if (matches == 0 && *text == '~' && mbschr (text, '/') == 0)
|
||||
matches = rl_completion_matches (text, rl_username_completion_function);
|
||||
|
||||
/* Another one. Why not? If the word starts in '@', then look through
|
||||
the world of known hostnames for completion first. */
|
||||
if (!matches && perform_hostname_completion && *text == '@')
|
||||
if (matches == 0 && perform_hostname_completion && *text == '@')
|
||||
matches = rl_completion_matches (text, hostname_completion_function);
|
||||
|
||||
/* And last, (but not least) if this word is in a command position, then
|
||||
|
||||
@@ -63,7 +63,7 @@ static const int brace_arg_separator = ',';
|
||||
static int brace_gobbler __P((char *, size_t, int *, int));
|
||||
static char **expand_amble __P((char *, size_t, int));
|
||||
static char **expand_seqterm __P((char *, size_t));
|
||||
static char **mkseq __P((int, int, int, int, int));
|
||||
static char **mkseq __P((intmax_t, intmax_t, int, int, int));
|
||||
static char **array_concat __P((char **, char **));
|
||||
#else
|
||||
static int brace_gobbler ();
|
||||
@@ -307,13 +307,15 @@ expand_amble (text, tlen, flags)
|
||||
|
||||
static char **
|
||||
mkseq (start, end, incr, type, width)
|
||||
int start, end, incr, type, width;
|
||||
intmax_t start, end;
|
||||
int incr, type, width;
|
||||
{
|
||||
int n, i;
|
||||
intmax_t n;
|
||||
int i;
|
||||
char **result, *t;
|
||||
|
||||
n = abs (end - start) + 1;
|
||||
result = strvec_create (n + 1);
|
||||
i = abs (end - start) + 1;
|
||||
result = strvec_create (i + 1);
|
||||
|
||||
if (incr == 0)
|
||||
incr = 1;
|
||||
@@ -362,7 +364,8 @@ expand_seqterm (text, tlen)
|
||||
size_t tlen;
|
||||
{
|
||||
char *t, *lhs, *rhs;
|
||||
int i, lhs_t, rhs_t, lhs_v, rhs_v, incr, lhs_l, rhs_l, width;
|
||||
int i, lhs_t, rhs_t, incr, lhs_l, rhs_l, width;
|
||||
intmax_t lhs_v, rhs_v;
|
||||
intmax_t tl, tr;
|
||||
char **result, *ep, *oep;
|
||||
|
||||
|
||||
+688
@@ -0,0 +1,688 @@
|
||||
/* braces.c -- code for doing word expansion in curly braces. */
|
||||
|
||||
/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
Bash is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Bash is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Bash. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* Stuff in curly braces gets expanded before all other shell expansions. */
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#if defined (BRACE_EXPANSION)
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
# ifdef _MINIX
|
||||
# include <sys/types.h>
|
||||
# endif
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "bashansi.h"
|
||||
|
||||
#if defined (SHELL)
|
||||
# include "shell.h"
|
||||
#endif /* SHELL */
|
||||
|
||||
#include "general.h"
|
||||
#include "shmbutil.h"
|
||||
#include "chartypes.h"
|
||||
|
||||
#define brace_whitespace(c) (!(c) || (c) == ' ' || (c) == '\t' || (c) == '\n')
|
||||
|
||||
#define BRACE_SEQ_SPECIFIER ".."
|
||||
|
||||
extern int asprintf __P((char **, const char *, ...)) __attribute__((__format__ (printf, 2, 3)));
|
||||
|
||||
/* Basic idea:
|
||||
|
||||
Segregate the text into 3 sections: preamble (stuff before an open brace),
|
||||
postamble (stuff after the matching close brace) and amble (stuff after
|
||||
preamble, and before postamble). Expand amble, and then tack on the
|
||||
expansions to preamble. Expand postamble, and tack on the expansions to
|
||||
the result so far.
|
||||
*/
|
||||
|
||||
/* The character which is used to separate arguments. */
|
||||
static const int brace_arg_separator = ',';
|
||||
|
||||
#if defined (__P)
|
||||
static int brace_gobbler __P((char *, size_t, int *, int));
|
||||
static char **expand_amble __P((char *, size_t, int));
|
||||
static char **expand_seqterm __P((char *, size_t));
|
||||
static char **mkseq __P((int, int, int, int, int));
|
||||
static char **array_concat __P((char **, char **));
|
||||
#else
|
||||
static int brace_gobbler ();
|
||||
static char **expand_amble ();
|
||||
static char **expand_seqterm ();
|
||||
static char **mkseq();
|
||||
static char **array_concat ();
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
static void
|
||||
dump_result (a)
|
||||
char **a;
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; a[i]; i++)
|
||||
printf ("dump_result: a[%d] = -%s-\n", i, a[i]);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Return an array of strings; the brace expansion of TEXT. */
|
||||
char **
|
||||
brace_expand (text)
|
||||
char *text;
|
||||
{
|
||||
register int start;
|
||||
size_t tlen;
|
||||
char *preamble, *postamble, *amble;
|
||||
size_t alen;
|
||||
char **tack, **result;
|
||||
int i, j, c, c1;
|
||||
|
||||
DECLARE_MBSTATE;
|
||||
|
||||
/* Find the text of the preamble. */
|
||||
tlen = strlen (text);
|
||||
i = 0;
|
||||
#if defined (CSH_BRACE_COMPAT)
|
||||
c = brace_gobbler (text, tlen, &i, '{'); /* } */
|
||||
#else
|
||||
/* Make sure that when we exit this loop, c == 0 or text[i] begins a
|
||||
valid brace expansion sequence. */
|
||||
do
|
||||
{
|
||||
c = brace_gobbler (text, tlen, &i, '{'); /* } */
|
||||
c1 = c;
|
||||
/* Verify that c begins a valid brace expansion word. If it doesn't, we
|
||||
go on. Loop stops when there are no more open braces in the word. */
|
||||
if (c)
|
||||
{
|
||||
start = j = i + 1; /* { */
|
||||
c = brace_gobbler (text, tlen, &j, '}');
|
||||
if (c == 0) /* it's not */
|
||||
{
|
||||
i++;
|
||||
c = c1;
|
||||
continue;
|
||||
}
|
||||
else /* it is */
|
||||
{
|
||||
c = c1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
while (c);
|
||||
#endif /* !CSH_BRACE_COMPAT */
|
||||
|
||||
preamble = (char *)xmalloc (i + 1);
|
||||
strncpy (preamble, text, i);
|
||||
preamble[i] = '\0';
|
||||
|
||||
result = (char **)xmalloc (2 * sizeof (char *));
|
||||
result[0] = preamble;
|
||||
result[1] = (char *)NULL;
|
||||
|
||||
/* Special case. If we never found an exciting character, then
|
||||
the preamble is all of the text, so just return that. */
|
||||
if (c != '{')
|
||||
return (result);
|
||||
|
||||
/* Find the amble. This is the stuff inside this set of braces. */
|
||||
start = ++i;
|
||||
c = brace_gobbler (text, tlen, &i, '}');
|
||||
|
||||
/* What if there isn't a matching close brace? */
|
||||
if (c == 0)
|
||||
{
|
||||
#if defined (NOTDEF)
|
||||
/* Well, if we found an unquoted BRACE_ARG_SEPARATOR between START
|
||||
and I, then this should be an error. Otherwise, it isn't. */
|
||||
j = start;
|
||||
while (j < i)
|
||||
{
|
||||
if (text[j] == '\\')
|
||||
{
|
||||
j++;
|
||||
ADVANCE_CHAR (text, tlen, j);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (text[j] == brace_arg_separator)
|
||||
{ /* { */
|
||||
strvec_dispose (result);
|
||||
report_error ("no closing `%c' in %s", '}', text);
|
||||
throw_to_top_level ();
|
||||
}
|
||||
ADVANCE_CHAR (text, tlen, j);
|
||||
}
|
||||
#endif
|
||||
free (preamble); /* Same as result[0]; see initialization. */
|
||||
result[0] = savestring (text);
|
||||
return (result);
|
||||
}
|
||||
|
||||
#if defined (SHELL)
|
||||
amble = substring (text, start, i);
|
||||
alen = i - start;
|
||||
#else
|
||||
amble = (char *)xmalloc (1 + (i - start));
|
||||
strncpy (amble, &text[start], (i - start));
|
||||
alen = i - start;
|
||||
amble[alen] = '\0';
|
||||
#endif
|
||||
|
||||
#if defined (SHELL)
|
||||
INITIALIZE_MBSTATE;
|
||||
|
||||
/* If the amble does not contain an unquoted BRACE_ARG_SEPARATOR, then
|
||||
just return without doing any expansion. */
|
||||
j = 0;
|
||||
while (amble[j])
|
||||
{
|
||||
if (amble[j] == '\\')
|
||||
{
|
||||
j++;
|
||||
ADVANCE_CHAR (amble, alen, j);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (amble[j] == brace_arg_separator)
|
||||
break;
|
||||
|
||||
ADVANCE_CHAR (amble, alen, j);
|
||||
}
|
||||
|
||||
if (amble[j] == 0)
|
||||
{
|
||||
tack = expand_seqterm (amble, alen);
|
||||
if (tack)
|
||||
goto add_tack;
|
||||
else
|
||||
{
|
||||
free (amble);
|
||||
free (preamble);
|
||||
result[0] = savestring (text);
|
||||
return (result);
|
||||
}
|
||||
}
|
||||
#endif /* SHELL */
|
||||
|
||||
tack = expand_amble (amble, alen, 0);
|
||||
add_tack:
|
||||
result = array_concat (result, tack);
|
||||
free (amble);
|
||||
strvec_dispose (tack);
|
||||
|
||||
postamble = text + i + 1;
|
||||
|
||||
tack = brace_expand (postamble);
|
||||
result = array_concat (result, tack);
|
||||
strvec_dispose (tack);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
/* Expand the text found inside of braces. We simply try to split the
|
||||
text at BRACE_ARG_SEPARATORs into separate strings. We then brace
|
||||
expand each slot which needs it, until there are no more slots which
|
||||
need it. */
|
||||
static char **
|
||||
expand_amble (text, tlen, flags)
|
||||
char *text;
|
||||
size_t tlen;
|
||||
int flags;
|
||||
{
|
||||
char **result, **partial;
|
||||
char *tem;
|
||||
int start, i, c;
|
||||
|
||||
DECLARE_MBSTATE;
|
||||
|
||||
result = (char **)NULL;
|
||||
|
||||
start = i = 0;
|
||||
c = 1;
|
||||
while (c)
|
||||
{
|
||||
c = brace_gobbler (text, tlen, &i, brace_arg_separator);
|
||||
#if defined (SHELL)
|
||||
tem = substring (text, start, i);
|
||||
#else
|
||||
tem = (char *)xmalloc (1 + (i - start));
|
||||
strncpy (tem, &text[start], (i - start));
|
||||
tem[i- start] = '\0';
|
||||
#endif
|
||||
|
||||
partial = brace_expand (tem);
|
||||
|
||||
if (!result)
|
||||
result = partial;
|
||||
else
|
||||
{
|
||||
register int lr, lp, j;
|
||||
|
||||
lr = strvec_len (result);
|
||||
lp = strvec_len (partial);
|
||||
|
||||
result = strvec_resize (result, lp + lr + 1);
|
||||
|
||||
for (j = 0; j < lp; j++)
|
||||
result[lr + j] = partial[j];
|
||||
|
||||
result[lr + j] = (char *)NULL;
|
||||
free (partial);
|
||||
}
|
||||
free (tem);
|
||||
ADVANCE_CHAR (text, tlen, i);
|
||||
start = i;
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
|
||||
#define ST_BAD 0
|
||||
#define ST_INT 1
|
||||
#define ST_CHAR 2
|
||||
#define ST_ZINT 3
|
||||
|
||||
static char **
|
||||
mkseq (start, end, incr, type, width)
|
||||
int start, end;
|
||||
int incr, type, width;
|
||||
{
|
||||
int n, i;
|
||||
char **result, *t;
|
||||
|
||||
n = abs (end - start) + 1;
|
||||
result = strvec_create (n + 1);
|
||||
|
||||
if (incr == 0)
|
||||
incr = 1;
|
||||
|
||||
if (start > end && incr > 0)
|
||||
incr = -incr;
|
||||
else if (start < end && incr < 0)
|
||||
incr = -incr;
|
||||
|
||||
/* Make sure we go through the loop at least once, so {3..3} prints `3' */
|
||||
i = 0;
|
||||
n = start;
|
||||
do
|
||||
{
|
||||
#if defined (SHELL)
|
||||
QUIT; /* XXX - memory leak here */
|
||||
#endif
|
||||
if (type == ST_INT)
|
||||
result[i++] = itos (n);
|
||||
else if (type == ST_ZINT)
|
||||
{
|
||||
int len;
|
||||
len = asprintf (&t, "%0*d", width, n);
|
||||
result[i++] = t;
|
||||
}
|
||||
else
|
||||
{
|
||||
t = (char *)xmalloc (2);
|
||||
t[0] = n;
|
||||
t[1] = '\0';
|
||||
result[i++] = t;
|
||||
}
|
||||
n += incr;
|
||||
if ((incr < 0 && n < end) || (incr > 0 && n > end))
|
||||
break;
|
||||
}
|
||||
while (1);
|
||||
|
||||
result[i] = (char *)0;
|
||||
return (result);
|
||||
}
|
||||
|
||||
static char **
|
||||
expand_seqterm (text, tlen)
|
||||
char *text;
|
||||
size_t tlen;
|
||||
{
|
||||
char *t, *lhs, *rhs;
|
||||
int i, lhs_t, rhs_t, lhs_v, rhs_v, incr, lhs_l, rhs_l, width;
|
||||
intmax_t tl, tr;
|
||||
char **result, *ep, *oep;
|
||||
|
||||
t = strstr (text, BRACE_SEQ_SPECIFIER);
|
||||
if (t == 0)
|
||||
return ((char **)NULL);
|
||||
|
||||
lhs_l = t - text; /* index of start of BRACE_SEQ_SPECIFIER */
|
||||
lhs = substring (text, 0, lhs_l);
|
||||
rhs = substring (text, lhs_l + sizeof(BRACE_SEQ_SPECIFIER) - 1, tlen);
|
||||
|
||||
if (lhs[0] == 0 || rhs[0] == 0)
|
||||
{
|
||||
free (lhs);
|
||||
free (rhs);
|
||||
return ((char **)NULL);
|
||||
}
|
||||
|
||||
/* Now figure out whether LHS and RHS are integers or letters. Both
|
||||
sides have to match. */
|
||||
lhs_t = (legal_number (lhs, &tl)) ? ST_INT :
|
||||
((ISALPHA (lhs[0]) && lhs[1] == 0) ? ST_CHAR : ST_BAD);
|
||||
|
||||
/* Decide on rhs and whether or not it looks like the user specified
|
||||
an increment */
|
||||
ep = 0;
|
||||
if (ISDIGIT (rhs[0]) || ((rhs[0] == '+' || rhs[0] == '-') && ISDIGIT (rhs[1])))
|
||||
{
|
||||
rhs_t = ST_INT;
|
||||
tr = strtoimax (rhs, &ep, 10);
|
||||
if (ep && *ep != 0 && *ep != '.')
|
||||
rhs_t = ST_BAD; /* invalid */
|
||||
}
|
||||
else if (ISALPHA (rhs[0]) && (rhs[1] == 0 || rhs[1] == '.'))
|
||||
{
|
||||
rhs_t = ST_CHAR;
|
||||
ep = rhs + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
rhs_t = ST_BAD;
|
||||
ep = 0;
|
||||
}
|
||||
|
||||
incr = 1;
|
||||
if (rhs_t != ST_BAD)
|
||||
{
|
||||
oep = ep;
|
||||
if (ep && *ep == '.' && ep[1] == '.' && ep[2])
|
||||
incr = strtoimax (ep + 2, &ep, 10);
|
||||
if (*ep != 0)
|
||||
rhs_t = ST_BAD; /* invalid incr */
|
||||
tlen -= ep - oep;
|
||||
}
|
||||
|
||||
if (lhs_t != rhs_t || lhs_t == ST_BAD || rhs_t == ST_BAD)
|
||||
{
|
||||
free (lhs);
|
||||
free (rhs);
|
||||
return ((char **)NULL);
|
||||
}
|
||||
|
||||
/* OK, we have something. It's either a sequence of integers, ascending
|
||||
or descending, or a sequence or letters, ditto. Generate the sequence,
|
||||
put it into a string vector, and return it. */
|
||||
|
||||
if (lhs_t == ST_CHAR)
|
||||
{
|
||||
lhs_v = (unsigned char)lhs[0];
|
||||
rhs_v = (unsigned char)rhs[0];
|
||||
width = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
lhs_v = tl; /* integer truncation */
|
||||
rhs_v = tr;
|
||||
|
||||
/* Decide whether or not the terms need zero-padding */
|
||||
rhs_l = tlen - lhs_l - sizeof (BRACE_SEQ_SPECIFIER) + 1;
|
||||
width = 0;
|
||||
if (lhs_l > 1 && lhs[0] == '0')
|
||||
width = lhs_l, lhs_t = ST_ZINT;
|
||||
if (lhs_l > 2 && lhs[0] == '-' && lhs[1] == '0')
|
||||
width = lhs_l, lhs_t = ST_ZINT;
|
||||
if (rhs_l > 1 && rhs[0] == '0' && width < rhs_l)
|
||||
width = rhs_l, lhs_t = ST_ZINT;
|
||||
if (rhs_l > 2 && rhs[0] == '-' && rhs[1] == '0' && width < rhs_l)
|
||||
width = rhs_l, lhs_t = ST_ZINT;
|
||||
|
||||
if (width < lhs_l && lhs_t == ST_ZINT)
|
||||
width = lhs_l;
|
||||
if (width < rhs_l && lhs_t == ST_ZINT)
|
||||
width = rhs_l;
|
||||
}
|
||||
|
||||
result = mkseq (lhs_v, rhs_v, incr, lhs_t, width);
|
||||
|
||||
free (lhs);
|
||||
free (rhs);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
/* Start at INDEX, and skip characters in TEXT. Set INDEX to the
|
||||
index of the character matching SATISFY. This understands about
|
||||
quoting. Return the character that caused us to stop searching;
|
||||
this is either the same as SATISFY, or 0. */
|
||||
/* If SATISFY is `}', we are looking for a brace expression, so we
|
||||
should enforce the rules that govern valid brace expansions:
|
||||
1) to count as an arg separator, a comma or `..' has to be outside
|
||||
an inner set of braces.
|
||||
*/
|
||||
static int
|
||||
brace_gobbler (text, tlen, indx, satisfy)
|
||||
char *text;
|
||||
size_t tlen;
|
||||
int *indx;
|
||||
int satisfy;
|
||||
{
|
||||
register int i, c, quoted, level, commas, pass_next;
|
||||
#if defined (SHELL)
|
||||
int si;
|
||||
char *t;
|
||||
#endif
|
||||
DECLARE_MBSTATE;
|
||||
|
||||
level = quoted = pass_next = 0;
|
||||
#if defined (CSH_BRACE_COMPAT)
|
||||
commas = 1;
|
||||
#else
|
||||
commas = (satisfy == '}') ? 0 : 1;
|
||||
#endif
|
||||
|
||||
i = *indx;
|
||||
while (c = text[i])
|
||||
{
|
||||
if (pass_next)
|
||||
{
|
||||
pass_next = 0;
|
||||
ADVANCE_CHAR (text, tlen, i);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* A backslash escapes the next character. This allows backslash to
|
||||
escape the quote character in a double-quoted string. */
|
||||
if (c == '\\' && (quoted == 0 || quoted == '"' || quoted == '`'))
|
||||
{
|
||||
pass_next = 1;
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
#if defined (SHELL)
|
||||
/* If compiling for the shell, treat ${...} like \{...} */
|
||||
if (c == '$' && text[i+1] == '{' && quoted != '\'') /* } */
|
||||
{
|
||||
pass_next = 1;
|
||||
i++;
|
||||
if (quoted == 0)
|
||||
level++;
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (quoted)
|
||||
{
|
||||
if (c == quoted)
|
||||
quoted = 0;
|
||||
ADVANCE_CHAR (text, tlen, i);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (c == '"' || c == '\'' || c == '`')
|
||||
{
|
||||
quoted = c;
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
#if defined (SHELL)
|
||||
/* Pass new-style command and process substitutions through unchanged. */
|
||||
if ((c == '$' || c == '<' || c == '>') && text[i+1] == '(') /* ) */
|
||||
{
|
||||
si = i + 2;
|
||||
t = extract_command_subst (text, &si, 0);
|
||||
i = si;
|
||||
free (t);
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (c == satisfy && level == 0 && quoted == 0 && commas > 0)
|
||||
{
|
||||
/* We ignore an open brace surrounded by whitespace, and also
|
||||
an open brace followed immediately by a close brace preceded
|
||||
by whitespace. */
|
||||
if (c == '{' &&
|
||||
((!i || brace_whitespace (text[i - 1])) &&
|
||||
(brace_whitespace (text[i + 1]) || text[i + 1] == '}')))
|
||||
{
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (c == '{')
|
||||
level++;
|
||||
else if (c == '}' && level)
|
||||
level--;
|
||||
#if !defined (CSH_BRACE_COMPAT)
|
||||
else if (satisfy == '}' && c == brace_arg_separator && level == 0)
|
||||
commas++;
|
||||
else if (satisfy == '}' && STREQN (text+i, BRACE_SEQ_SPECIFIER, 2) &&
|
||||
text[i+2] != satisfy && level == 0)
|
||||
commas++;
|
||||
#endif
|
||||
|
||||
ADVANCE_CHAR (text, tlen, i);
|
||||
}
|
||||
|
||||
*indx = i;
|
||||
return (c);
|
||||
}
|
||||
|
||||
/* Return a new array of strings which is the result of appending each
|
||||
string in ARR2 to each string in ARR1. The resultant array is
|
||||
len (arr1) * len (arr2) long. For convenience, ARR1 (and its contents)
|
||||
are free ()'ed. ARR1 can be NULL, in that case, a new version of ARR2
|
||||
is returned. */
|
||||
static char **
|
||||
array_concat (arr1, arr2)
|
||||
char **arr1, **arr2;
|
||||
{
|
||||
register int i, j, len, len1, len2;
|
||||
register char **result;
|
||||
|
||||
if (arr1 == 0)
|
||||
return (strvec_copy (arr2));
|
||||
|
||||
if (arr2 == 0)
|
||||
return (strvec_copy (arr1));
|
||||
|
||||
len1 = strvec_len (arr1);
|
||||
len2 = strvec_len (arr2);
|
||||
|
||||
result = (char **)xmalloc ((1 + (len1 * len2)) * sizeof (char *));
|
||||
|
||||
len = 0;
|
||||
for (i = 0; i < len1; i++)
|
||||
{
|
||||
int strlen_1 = strlen (arr1[i]);
|
||||
|
||||
for (j = 0; j < len2; j++)
|
||||
{
|
||||
result[len] = (char *)xmalloc (1 + strlen_1 + strlen (arr2[j]));
|
||||
strcpy (result[len], arr1[i]);
|
||||
strcpy (result[len] + strlen_1, arr2[j]);
|
||||
len++;
|
||||
}
|
||||
free (arr1[i]);
|
||||
}
|
||||
free (arr1);
|
||||
|
||||
result[len] = (char *)NULL;
|
||||
return (result);
|
||||
}
|
||||
|
||||
#if defined (TEST)
|
||||
#include <stdio.h>
|
||||
|
||||
fatal_error (format, arg1, arg2)
|
||||
char *format, *arg1, *arg2;
|
||||
{
|
||||
report_error (format, arg1, arg2);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
report_error (format, arg1, arg2)
|
||||
char *format, *arg1, *arg2;
|
||||
{
|
||||
fprintf (stderr, format, arg1, arg2);
|
||||
fprintf (stderr, "\n");
|
||||
}
|
||||
|
||||
main ()
|
||||
{
|
||||
char example[256];
|
||||
|
||||
for (;;)
|
||||
{
|
||||
char **result;
|
||||
int i;
|
||||
|
||||
fprintf (stderr, "brace_expand> ");
|
||||
|
||||
if ((!fgets (example, 256, stdin)) ||
|
||||
(strncmp (example, "quit", 4) == 0))
|
||||
break;
|
||||
|
||||
if (strlen (example))
|
||||
example[strlen (example) - 1] = '\0';
|
||||
|
||||
result = brace_expand (example);
|
||||
|
||||
for (i = 0; result[i]; i++)
|
||||
printf ("%s\n", result[i]);
|
||||
|
||||
free_array (result);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* compile-command: "gcc -g -Bstatic -DTEST -o brace_expand braces.c general.o"
|
||||
* end:
|
||||
*/
|
||||
|
||||
#endif /* TEST */
|
||||
#endif /* BRACE_EXPANSION */
|
||||
@@ -0,0 +1,689 @@
|
||||
/* braces.c -- code for doing word expansion in curly braces. */
|
||||
|
||||
/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
Bash is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Bash is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Bash. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* Stuff in curly braces gets expanded before all other shell expansions. */
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#if defined (BRACE_EXPANSION)
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
# ifdef _MINIX
|
||||
# include <sys/types.h>
|
||||
# endif
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "bashansi.h"
|
||||
|
||||
#if defined (SHELL)
|
||||
# include "shell.h"
|
||||
#endif /* SHELL */
|
||||
|
||||
#include "general.h"
|
||||
#include "shmbutil.h"
|
||||
#include "chartypes.h"
|
||||
|
||||
#define brace_whitespace(c) (!(c) || (c) == ' ' || (c) == '\t' || (c) == '\n')
|
||||
|
||||
#define BRACE_SEQ_SPECIFIER ".."
|
||||
|
||||
extern int asprintf __P((char **, const char *, ...)) __attribute__((__format__ (printf, 2, 3)));
|
||||
|
||||
/* Basic idea:
|
||||
|
||||
Segregate the text into 3 sections: preamble (stuff before an open brace),
|
||||
postamble (stuff after the matching close brace) and amble (stuff after
|
||||
preamble, and before postamble). Expand amble, and then tack on the
|
||||
expansions to preamble. Expand postamble, and tack on the expansions to
|
||||
the result so far.
|
||||
*/
|
||||
|
||||
/* The character which is used to separate arguments. */
|
||||
static const int brace_arg_separator = ',';
|
||||
|
||||
#if defined (__P)
|
||||
static int brace_gobbler __P((char *, size_t, int *, int));
|
||||
static char **expand_amble __P((char *, size_t, int));
|
||||
static char **expand_seqterm __P((char *, size_t));
|
||||
static char **mkseq __P((intmax_t, intmax_t, int, int, int));
|
||||
static char **array_concat __P((char **, char **));
|
||||
#else
|
||||
static int brace_gobbler ();
|
||||
static char **expand_amble ();
|
||||
static char **expand_seqterm ();
|
||||
static char **mkseq();
|
||||
static char **array_concat ();
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
static void
|
||||
dump_result (a)
|
||||
char **a;
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; a[i]; i++)
|
||||
printf ("dump_result: a[%d] = -%s-\n", i, a[i]);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Return an array of strings; the brace expansion of TEXT. */
|
||||
char **
|
||||
brace_expand (text)
|
||||
char *text;
|
||||
{
|
||||
register int start;
|
||||
size_t tlen;
|
||||
char *preamble, *postamble, *amble;
|
||||
size_t alen;
|
||||
char **tack, **result;
|
||||
int i, j, c, c1;
|
||||
|
||||
DECLARE_MBSTATE;
|
||||
|
||||
/* Find the text of the preamble. */
|
||||
tlen = strlen (text);
|
||||
i = 0;
|
||||
#if defined (CSH_BRACE_COMPAT)
|
||||
c = brace_gobbler (text, tlen, &i, '{'); /* } */
|
||||
#else
|
||||
/* Make sure that when we exit this loop, c == 0 or text[i] begins a
|
||||
valid brace expansion sequence. */
|
||||
do
|
||||
{
|
||||
c = brace_gobbler (text, tlen, &i, '{'); /* } */
|
||||
c1 = c;
|
||||
/* Verify that c begins a valid brace expansion word. If it doesn't, we
|
||||
go on. Loop stops when there are no more open braces in the word. */
|
||||
if (c)
|
||||
{
|
||||
start = j = i + 1; /* { */
|
||||
c = brace_gobbler (text, tlen, &j, '}');
|
||||
if (c == 0) /* it's not */
|
||||
{
|
||||
i++;
|
||||
c = c1;
|
||||
continue;
|
||||
}
|
||||
else /* it is */
|
||||
{
|
||||
c = c1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
while (c);
|
||||
#endif /* !CSH_BRACE_COMPAT */
|
||||
|
||||
preamble = (char *)xmalloc (i + 1);
|
||||
strncpy (preamble, text, i);
|
||||
preamble[i] = '\0';
|
||||
|
||||
result = (char **)xmalloc (2 * sizeof (char *));
|
||||
result[0] = preamble;
|
||||
result[1] = (char *)NULL;
|
||||
|
||||
/* Special case. If we never found an exciting character, then
|
||||
the preamble is all of the text, so just return that. */
|
||||
if (c != '{')
|
||||
return (result);
|
||||
|
||||
/* Find the amble. This is the stuff inside this set of braces. */
|
||||
start = ++i;
|
||||
c = brace_gobbler (text, tlen, &i, '}');
|
||||
|
||||
/* What if there isn't a matching close brace? */
|
||||
if (c == 0)
|
||||
{
|
||||
#if defined (NOTDEF)
|
||||
/* Well, if we found an unquoted BRACE_ARG_SEPARATOR between START
|
||||
and I, then this should be an error. Otherwise, it isn't. */
|
||||
j = start;
|
||||
while (j < i)
|
||||
{
|
||||
if (text[j] == '\\')
|
||||
{
|
||||
j++;
|
||||
ADVANCE_CHAR (text, tlen, j);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (text[j] == brace_arg_separator)
|
||||
{ /* { */
|
||||
strvec_dispose (result);
|
||||
report_error ("no closing `%c' in %s", '}', text);
|
||||
throw_to_top_level ();
|
||||
}
|
||||
ADVANCE_CHAR (text, tlen, j);
|
||||
}
|
||||
#endif
|
||||
free (preamble); /* Same as result[0]; see initialization. */
|
||||
result[0] = savestring (text);
|
||||
return (result);
|
||||
}
|
||||
|
||||
#if defined (SHELL)
|
||||
amble = substring (text, start, i);
|
||||
alen = i - start;
|
||||
#else
|
||||
amble = (char *)xmalloc (1 + (i - start));
|
||||
strncpy (amble, &text[start], (i - start));
|
||||
alen = i - start;
|
||||
amble[alen] = '\0';
|
||||
#endif
|
||||
|
||||
#if defined (SHELL)
|
||||
INITIALIZE_MBSTATE;
|
||||
|
||||
/* If the amble does not contain an unquoted BRACE_ARG_SEPARATOR, then
|
||||
just return without doing any expansion. */
|
||||
j = 0;
|
||||
while (amble[j])
|
||||
{
|
||||
if (amble[j] == '\\')
|
||||
{
|
||||
j++;
|
||||
ADVANCE_CHAR (amble, alen, j);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (amble[j] == brace_arg_separator)
|
||||
break;
|
||||
|
||||
ADVANCE_CHAR (amble, alen, j);
|
||||
}
|
||||
|
||||
if (amble[j] == 0)
|
||||
{
|
||||
tack = expand_seqterm (amble, alen);
|
||||
if (tack)
|
||||
goto add_tack;
|
||||
else
|
||||
{
|
||||
free (amble);
|
||||
free (preamble);
|
||||
result[0] = savestring (text);
|
||||
return (result);
|
||||
}
|
||||
}
|
||||
#endif /* SHELL */
|
||||
|
||||
tack = expand_amble (amble, alen, 0);
|
||||
add_tack:
|
||||
result = array_concat (result, tack);
|
||||
free (amble);
|
||||
strvec_dispose (tack);
|
||||
|
||||
postamble = text + i + 1;
|
||||
|
||||
tack = brace_expand (postamble);
|
||||
result = array_concat (result, tack);
|
||||
strvec_dispose (tack);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
/* Expand the text found inside of braces. We simply try to split the
|
||||
text at BRACE_ARG_SEPARATORs into separate strings. We then brace
|
||||
expand each slot which needs it, until there are no more slots which
|
||||
need it. */
|
||||
static char **
|
||||
expand_amble (text, tlen, flags)
|
||||
char *text;
|
||||
size_t tlen;
|
||||
int flags;
|
||||
{
|
||||
char **result, **partial;
|
||||
char *tem;
|
||||
int start, i, c;
|
||||
|
||||
DECLARE_MBSTATE;
|
||||
|
||||
result = (char **)NULL;
|
||||
|
||||
start = i = 0;
|
||||
c = 1;
|
||||
while (c)
|
||||
{
|
||||
c = brace_gobbler (text, tlen, &i, brace_arg_separator);
|
||||
#if defined (SHELL)
|
||||
tem = substring (text, start, i);
|
||||
#else
|
||||
tem = (char *)xmalloc (1 + (i - start));
|
||||
strncpy (tem, &text[start], (i - start));
|
||||
tem[i- start] = '\0';
|
||||
#endif
|
||||
|
||||
partial = brace_expand (tem);
|
||||
|
||||
if (!result)
|
||||
result = partial;
|
||||
else
|
||||
{
|
||||
register int lr, lp, j;
|
||||
|
||||
lr = strvec_len (result);
|
||||
lp = strvec_len (partial);
|
||||
|
||||
result = strvec_resize (result, lp + lr + 1);
|
||||
|
||||
for (j = 0; j < lp; j++)
|
||||
result[lr + j] = partial[j];
|
||||
|
||||
result[lr + j] = (char *)NULL;
|
||||
free (partial);
|
||||
}
|
||||
free (tem);
|
||||
ADVANCE_CHAR (text, tlen, i);
|
||||
start = i;
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
|
||||
#define ST_BAD 0
|
||||
#define ST_INT 1
|
||||
#define ST_CHAR 2
|
||||
#define ST_ZINT 3
|
||||
|
||||
static char **
|
||||
mkseq (start, end, incr, type, width)
|
||||
intmax_t start, end;
|
||||
int incr, type, width;
|
||||
{
|
||||
intmax_t n;
|
||||
int i;
|
||||
char **result, *t;
|
||||
|
||||
i = abs (end - start) + 1;
|
||||
result = strvec_create (i + 1);
|
||||
|
||||
if (incr == 0)
|
||||
incr = 1;
|
||||
|
||||
if (start > end && incr > 0)
|
||||
incr = -incr;
|
||||
else if (start < end && incr < 0)
|
||||
incr = -incr;
|
||||
|
||||
/* Make sure we go through the loop at least once, so {3..3} prints `3' */
|
||||
i = 0;
|
||||
n = start;
|
||||
do
|
||||
{
|
||||
#if defined (SHELL)
|
||||
QUIT; /* XXX - memory leak here */
|
||||
#endif
|
||||
if (type == ST_INT)
|
||||
result[i++] = itos (n);
|
||||
else if (type == ST_ZINT)
|
||||
{
|
||||
int len;
|
||||
len = asprintf (&t, "%0*d", width, n);
|
||||
result[i++] = t;
|
||||
}
|
||||
else
|
||||
{
|
||||
t = (char *)xmalloc (2);
|
||||
t[0] = n;
|
||||
t[1] = '\0';
|
||||
result[i++] = t;
|
||||
}
|
||||
n += incr;
|
||||
if ((incr < 0 && n < end) || (incr > 0 && n > end))
|
||||
break;
|
||||
}
|
||||
while (1);
|
||||
|
||||
result[i] = (char *)0;
|
||||
return (result);
|
||||
}
|
||||
|
||||
static char **
|
||||
expand_seqterm (text, tlen)
|
||||
char *text;
|
||||
size_t tlen;
|
||||
{
|
||||
char *t, *lhs, *rhs;
|
||||
int i, lhs_t, rhs_t, lhs_v, rhs_v, incr, lhs_l, rhs_l, width;
|
||||
intmax_t tl, tr;
|
||||
char **result, *ep, *oep;
|
||||
|
||||
t = strstr (text, BRACE_SEQ_SPECIFIER);
|
||||
if (t == 0)
|
||||
return ((char **)NULL);
|
||||
|
||||
lhs_l = t - text; /* index of start of BRACE_SEQ_SPECIFIER */
|
||||
lhs = substring (text, 0, lhs_l);
|
||||
rhs = substring (text, lhs_l + sizeof(BRACE_SEQ_SPECIFIER) - 1, tlen);
|
||||
|
||||
if (lhs[0] == 0 || rhs[0] == 0)
|
||||
{
|
||||
free (lhs);
|
||||
free (rhs);
|
||||
return ((char **)NULL);
|
||||
}
|
||||
|
||||
/* Now figure out whether LHS and RHS are integers or letters. Both
|
||||
sides have to match. */
|
||||
lhs_t = (legal_number (lhs, &tl)) ? ST_INT :
|
||||
((ISALPHA (lhs[0]) && lhs[1] == 0) ? ST_CHAR : ST_BAD);
|
||||
|
||||
/* Decide on rhs and whether or not it looks like the user specified
|
||||
an increment */
|
||||
ep = 0;
|
||||
if (ISDIGIT (rhs[0]) || ((rhs[0] == '+' || rhs[0] == '-') && ISDIGIT (rhs[1])))
|
||||
{
|
||||
rhs_t = ST_INT;
|
||||
tr = strtoimax (rhs, &ep, 10);
|
||||
if (ep && *ep != 0 && *ep != '.')
|
||||
rhs_t = ST_BAD; /* invalid */
|
||||
}
|
||||
else if (ISALPHA (rhs[0]) && (rhs[1] == 0 || rhs[1] == '.'))
|
||||
{
|
||||
rhs_t = ST_CHAR;
|
||||
ep = rhs + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
rhs_t = ST_BAD;
|
||||
ep = 0;
|
||||
}
|
||||
|
||||
incr = 1;
|
||||
if (rhs_t != ST_BAD)
|
||||
{
|
||||
oep = ep;
|
||||
if (ep && *ep == '.' && ep[1] == '.' && ep[2])
|
||||
incr = strtoimax (ep + 2, &ep, 10);
|
||||
if (*ep != 0)
|
||||
rhs_t = ST_BAD; /* invalid incr */
|
||||
tlen -= ep - oep;
|
||||
}
|
||||
|
||||
if (lhs_t != rhs_t || lhs_t == ST_BAD || rhs_t == ST_BAD)
|
||||
{
|
||||
free (lhs);
|
||||
free (rhs);
|
||||
return ((char **)NULL);
|
||||
}
|
||||
|
||||
/* OK, we have something. It's either a sequence of integers, ascending
|
||||
or descending, or a sequence or letters, ditto. Generate the sequence,
|
||||
put it into a string vector, and return it. */
|
||||
|
||||
if (lhs_t == ST_CHAR)
|
||||
{
|
||||
lhs_v = (unsigned char)lhs[0];
|
||||
rhs_v = (unsigned char)rhs[0];
|
||||
width = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
lhs_v = tl; /* integer truncation */
|
||||
rhs_v = tr;
|
||||
|
||||
/* Decide whether or not the terms need zero-padding */
|
||||
rhs_l = tlen - lhs_l - sizeof (BRACE_SEQ_SPECIFIER) + 1;
|
||||
width = 0;
|
||||
if (lhs_l > 1 && lhs[0] == '0')
|
||||
width = lhs_l, lhs_t = ST_ZINT;
|
||||
if (lhs_l > 2 && lhs[0] == '-' && lhs[1] == '0')
|
||||
width = lhs_l, lhs_t = ST_ZINT;
|
||||
if (rhs_l > 1 && rhs[0] == '0' && width < rhs_l)
|
||||
width = rhs_l, lhs_t = ST_ZINT;
|
||||
if (rhs_l > 2 && rhs[0] == '-' && rhs[1] == '0' && width < rhs_l)
|
||||
width = rhs_l, lhs_t = ST_ZINT;
|
||||
|
||||
if (width < lhs_l && lhs_t == ST_ZINT)
|
||||
width = lhs_l;
|
||||
if (width < rhs_l && lhs_t == ST_ZINT)
|
||||
width = rhs_l;
|
||||
}
|
||||
|
||||
result = mkseq (lhs_v, rhs_v, incr, lhs_t, width);
|
||||
|
||||
free (lhs);
|
||||
free (rhs);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
/* Start at INDEX, and skip characters in TEXT. Set INDEX to the
|
||||
index of the character matching SATISFY. This understands about
|
||||
quoting. Return the character that caused us to stop searching;
|
||||
this is either the same as SATISFY, or 0. */
|
||||
/* If SATISFY is `}', we are looking for a brace expression, so we
|
||||
should enforce the rules that govern valid brace expansions:
|
||||
1) to count as an arg separator, a comma or `..' has to be outside
|
||||
an inner set of braces.
|
||||
*/
|
||||
static int
|
||||
brace_gobbler (text, tlen, indx, satisfy)
|
||||
char *text;
|
||||
size_t tlen;
|
||||
int *indx;
|
||||
int satisfy;
|
||||
{
|
||||
register int i, c, quoted, level, commas, pass_next;
|
||||
#if defined (SHELL)
|
||||
int si;
|
||||
char *t;
|
||||
#endif
|
||||
DECLARE_MBSTATE;
|
||||
|
||||
level = quoted = pass_next = 0;
|
||||
#if defined (CSH_BRACE_COMPAT)
|
||||
commas = 1;
|
||||
#else
|
||||
commas = (satisfy == '}') ? 0 : 1;
|
||||
#endif
|
||||
|
||||
i = *indx;
|
||||
while (c = text[i])
|
||||
{
|
||||
if (pass_next)
|
||||
{
|
||||
pass_next = 0;
|
||||
ADVANCE_CHAR (text, tlen, i);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* A backslash escapes the next character. This allows backslash to
|
||||
escape the quote character in a double-quoted string. */
|
||||
if (c == '\\' && (quoted == 0 || quoted == '"' || quoted == '`'))
|
||||
{
|
||||
pass_next = 1;
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
#if defined (SHELL)
|
||||
/* If compiling for the shell, treat ${...} like \{...} */
|
||||
if (c == '$' && text[i+1] == '{' && quoted != '\'') /* } */
|
||||
{
|
||||
pass_next = 1;
|
||||
i++;
|
||||
if (quoted == 0)
|
||||
level++;
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (quoted)
|
||||
{
|
||||
if (c == quoted)
|
||||
quoted = 0;
|
||||
ADVANCE_CHAR (text, tlen, i);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (c == '"' || c == '\'' || c == '`')
|
||||
{
|
||||
quoted = c;
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
#if defined (SHELL)
|
||||
/* Pass new-style command and process substitutions through unchanged. */
|
||||
if ((c == '$' || c == '<' || c == '>') && text[i+1] == '(') /* ) */
|
||||
{
|
||||
si = i + 2;
|
||||
t = extract_command_subst (text, &si, 0);
|
||||
i = si;
|
||||
free (t);
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (c == satisfy && level == 0 && quoted == 0 && commas > 0)
|
||||
{
|
||||
/* We ignore an open brace surrounded by whitespace, and also
|
||||
an open brace followed immediately by a close brace preceded
|
||||
by whitespace. */
|
||||
if (c == '{' &&
|
||||
((!i || brace_whitespace (text[i - 1])) &&
|
||||
(brace_whitespace (text[i + 1]) || text[i + 1] == '}')))
|
||||
{
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (c == '{')
|
||||
level++;
|
||||
else if (c == '}' && level)
|
||||
level--;
|
||||
#if !defined (CSH_BRACE_COMPAT)
|
||||
else if (satisfy == '}' && c == brace_arg_separator && level == 0)
|
||||
commas++;
|
||||
else if (satisfy == '}' && STREQN (text+i, BRACE_SEQ_SPECIFIER, 2) &&
|
||||
text[i+2] != satisfy && level == 0)
|
||||
commas++;
|
||||
#endif
|
||||
|
||||
ADVANCE_CHAR (text, tlen, i);
|
||||
}
|
||||
|
||||
*indx = i;
|
||||
return (c);
|
||||
}
|
||||
|
||||
/* Return a new array of strings which is the result of appending each
|
||||
string in ARR2 to each string in ARR1. The resultant array is
|
||||
len (arr1) * len (arr2) long. For convenience, ARR1 (and its contents)
|
||||
are free ()'ed. ARR1 can be NULL, in that case, a new version of ARR2
|
||||
is returned. */
|
||||
static char **
|
||||
array_concat (arr1, arr2)
|
||||
char **arr1, **arr2;
|
||||
{
|
||||
register int i, j, len, len1, len2;
|
||||
register char **result;
|
||||
|
||||
if (arr1 == 0)
|
||||
return (strvec_copy (arr2));
|
||||
|
||||
if (arr2 == 0)
|
||||
return (strvec_copy (arr1));
|
||||
|
||||
len1 = strvec_len (arr1);
|
||||
len2 = strvec_len (arr2);
|
||||
|
||||
result = (char **)xmalloc ((1 + (len1 * len2)) * sizeof (char *));
|
||||
|
||||
len = 0;
|
||||
for (i = 0; i < len1; i++)
|
||||
{
|
||||
int strlen_1 = strlen (arr1[i]);
|
||||
|
||||
for (j = 0; j < len2; j++)
|
||||
{
|
||||
result[len] = (char *)xmalloc (1 + strlen_1 + strlen (arr2[j]));
|
||||
strcpy (result[len], arr1[i]);
|
||||
strcpy (result[len] + strlen_1, arr2[j]);
|
||||
len++;
|
||||
}
|
||||
free (arr1[i]);
|
||||
}
|
||||
free (arr1);
|
||||
|
||||
result[len] = (char *)NULL;
|
||||
return (result);
|
||||
}
|
||||
|
||||
#if defined (TEST)
|
||||
#include <stdio.h>
|
||||
|
||||
fatal_error (format, arg1, arg2)
|
||||
char *format, *arg1, *arg2;
|
||||
{
|
||||
report_error (format, arg1, arg2);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
report_error (format, arg1, arg2)
|
||||
char *format, *arg1, *arg2;
|
||||
{
|
||||
fprintf (stderr, format, arg1, arg2);
|
||||
fprintf (stderr, "\n");
|
||||
}
|
||||
|
||||
main ()
|
||||
{
|
||||
char example[256];
|
||||
|
||||
for (;;)
|
||||
{
|
||||
char **result;
|
||||
int i;
|
||||
|
||||
fprintf (stderr, "brace_expand> ");
|
||||
|
||||
if ((!fgets (example, 256, stdin)) ||
|
||||
(strncmp (example, "quit", 4) == 0))
|
||||
break;
|
||||
|
||||
if (strlen (example))
|
||||
example[strlen (example) - 1] = '\0';
|
||||
|
||||
result = brace_expand (example);
|
||||
|
||||
for (i = 0; result[i]; i++)
|
||||
printf ("%s\n", result[i]);
|
||||
|
||||
free_array (result);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* compile-command: "gcc -g -Bstatic -DTEST -o brace_expand braces.c general.o"
|
||||
* end:
|
||||
*/
|
||||
|
||||
#endif /* TEST */
|
||||
#endif /* BRACE_EXPANSION */
|
||||
@@ -283,6 +283,7 @@ cd_builtin (list)
|
||||
free (temp);
|
||||
}
|
||||
|
||||
#if 0 /* changed for bash-4.2 Posix cd description steps 5-6 */
|
||||
/* POSIX.2 says that if `.' does not appear in $CDPATH, we don't
|
||||
try the current directory, so we just punt now with an error
|
||||
message if POSIXLY_CORRECT is non-zero. The check for cdpath[0]
|
||||
@@ -293,6 +294,7 @@ cd_builtin (list)
|
||||
builtin_error ("%s: %s", dirname, strerror (ENOENT));
|
||||
return (EXECUTION_FAILURE);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
dirname = list->word->word;
|
||||
|
||||
+5
-1
@@ -35,7 +35,11 @@ value. If ARG is the null string each SIGNAL_SPEC is ignored by the
|
||||
shell and by the commands it invokes.
|
||||
|
||||
If a SIGNAL_SPEC is EXIT (0) ARG is executed on exit from the shell. If
|
||||
a SIGNAL_SPEC is DEBUG, ARG is executed before every simple command.
|
||||
a SIGNAL_SPEC is DEBUG, ARG is executed before every simple command. If
|
||||
a SIGNAL_SPEC is RETURN, ARG is executed each time a shell function or a
|
||||
script run by the . or source builtins finishes executing. A SIGNAL_SPEC
|
||||
of ERR means to execute ARG each time a command's failure would cause the
|
||||
shell to exit when the -e option is enabled.
|
||||
|
||||
If no arguments are supplied, trap prints the list of commands associated
|
||||
with each signal.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#! /bin/sh
|
||||
# From configure.in for Bash 4.2, version 4.033.
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.63 for bash 4.2-devel.
|
||||
# Generated by GNU Autoconf 2.63 for bash 4.2-alpha.
|
||||
#
|
||||
# Report bugs to <bug-bash@gnu.org>.
|
||||
#
|
||||
@@ -597,8 +597,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
|
||||
# Identity of this package.
|
||||
PACKAGE_NAME='bash'
|
||||
PACKAGE_TARNAME='bash'
|
||||
PACKAGE_VERSION='4.2-devel'
|
||||
PACKAGE_STRING='bash 4.2-devel'
|
||||
PACKAGE_VERSION='4.2-alpha'
|
||||
PACKAGE_STRING='bash 4.2-alpha'
|
||||
PACKAGE_BUGREPORT='bug-bash@gnu.org'
|
||||
|
||||
ac_unique_file="shell.h"
|
||||
@@ -1408,7 +1408,7 @@ if test "$ac_init_help" = "long"; then
|
||||
# Omit some internal or obsolete options to make the list less imposing.
|
||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||
cat <<_ACEOF
|
||||
\`configure' configures bash 4.2-devel to adapt to many kinds of systems.
|
||||
\`configure' configures bash 4.2-alpha to adapt to many kinds of systems.
|
||||
|
||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||
|
||||
@@ -1473,7 +1473,7 @@ fi
|
||||
|
||||
if test -n "$ac_init_help"; then
|
||||
case $ac_init_help in
|
||||
short | recursive ) echo "Configuration of bash 4.2-devel:";;
|
||||
short | recursive ) echo "Configuration of bash 4.2-alpha:";;
|
||||
esac
|
||||
cat <<\_ACEOF
|
||||
|
||||
@@ -1648,7 +1648,7 @@ fi
|
||||
test -n "$ac_init_help" && exit $ac_status
|
||||
if $ac_init_version; then
|
||||
cat <<\_ACEOF
|
||||
bash configure 4.2-devel
|
||||
bash configure 4.2-alpha
|
||||
generated by GNU Autoconf 2.63
|
||||
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
|
||||
@@ -1662,7 +1662,7 @@ cat >config.log <<_ACEOF
|
||||
This file contains any messages produced by compilers while
|
||||
running configure, to aid debugging if configure makes a mistake.
|
||||
|
||||
It was created by bash $as_me 4.2-devel, which was
|
||||
It was created by bash $as_me 4.2-alpha, which was
|
||||
generated by GNU Autoconf 2.63. Invocation command line was
|
||||
|
||||
$ $0 $@
|
||||
@@ -2076,7 +2076,7 @@ ac_config_headers="$ac_config_headers config.h"
|
||||
|
||||
|
||||
BASHVERS=4.2
|
||||
RELSTATUS=devel
|
||||
RELSTATUS=alpha
|
||||
|
||||
case "$RELSTATUS" in
|
||||
alp*|bet*|dev*|rc*|maint*) DEBUG='-DDEBUG' MALLOC_DEBUG='-DMALLOC_DEBUG' ;;
|
||||
@@ -31860,7 +31860,7 @@ exec 6>&1
|
||||
# report actual input values of CONFIG_FILES etc. instead of their
|
||||
# values after options handling.
|
||||
ac_log="
|
||||
This file was extended by bash $as_me 4.2-devel, which was
|
||||
This file was extended by bash $as_me 4.2-alpha, which was
|
||||
generated by GNU Autoconf 2.63. Invocation command line was
|
||||
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
@@ -31923,7 +31923,7 @@ Report bugs to <bug-autoconf@gnu.org>."
|
||||
_ACEOF
|
||||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||
ac_cs_version="\\
|
||||
bash config.status 4.2-devel
|
||||
bash config.status 4.2-alpha
|
||||
configured by $0, generated by GNU Autoconf 2.63,
|
||||
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
|
||||
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ dnl Process this file with autoconf to produce a configure script.
|
||||
AC_REVISION([for Bash 4.2, version 4.033])dnl
|
||||
|
||||
define(bashvers, 4.2)
|
||||
define(relstatus, devel)
|
||||
define(relstatus, alpha)
|
||||
|
||||
AC_INIT([bash], bashvers-relstatus, [bug-bash@gnu.org])
|
||||
|
||||
|
||||
+4
-2
@@ -21,7 +21,7 @@ dnl Process this file with autoconf to produce a configure script.
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
AC_REVISION([for Bash 4.2, version 4.032])dnl
|
||||
AC_REVISION([for Bash 4.2, version 4.033])dnl
|
||||
|
||||
define(bashvers, 4.2)
|
||||
define(relstatus, devel)
|
||||
@@ -98,7 +98,7 @@ esac
|
||||
dnl
|
||||
dnl macros for the bash debugger
|
||||
dnl
|
||||
AM_PATH_LISPDIR
|
||||
dnl AM_PATH_LISPDIR
|
||||
AC_ARG_VAR(DEBUGGER_START_FILE, [location of bash debugger initialization file])
|
||||
|
||||
dnl arguments to configure
|
||||
@@ -905,6 +905,8 @@ BASH_CHECK_TYPE(socklen_t, [#include <sys/socket.h>], int, HAVE_SOCKLEN_T)
|
||||
fi
|
||||
BASH_TYPE_RLIMIT
|
||||
|
||||
AC_CHECK_SIZEOF(intmax_t, 8)
|
||||
|
||||
dnl presence and contents of structures used by system calls
|
||||
BASH_STRUCT_TERMIOS_LDISC
|
||||
BASH_STRUCT_TERMIO_LDISC
|
||||
|
||||
@@ -0,0 +1,135 @@
|
||||
*** ../bash-20101015/redir.c 2009-09-17 10:04:18.000000000 -0400
|
||||
--- redir.c 2010-11-06 13:38:22.000000000 -0400
|
||||
***************
|
||||
*** 63,73 ****
|
||||
|
||||
extern int posixly_correct;
|
||||
extern REDIRECT *redirection_undo_list;
|
||||
extern REDIRECT *exec_redirection_undo_list;
|
||||
|
||||
/* Static functions defined and used in this file. */
|
||||
- static void add_undo_close_redirect __P((int));
|
||||
static void add_exec_redirect __P((REDIRECT *));
|
||||
static int add_undo_redirect __P((int, enum r_instruction, int));
|
||||
static int expandable_redirection_filename __P((REDIRECT *));
|
||||
static int stdin_redirection __P((enum r_instruction, int));
|
||||
--- 63,74 ----
|
||||
|
||||
extern int posixly_correct;
|
||||
+ extern int last_command_exit_value;
|
||||
extern REDIRECT *redirection_undo_list;
|
||||
extern REDIRECT *exec_redirection_undo_list;
|
||||
|
||||
/* Static functions defined and used in this file. */
|
||||
static void add_exec_redirect __P((REDIRECT *));
|
||||
static int add_undo_redirect __P((int, enum r_instruction, int));
|
||||
+ static int add_undo_close_redirect __P((int));
|
||||
static int expandable_redirection_filename __P((REDIRECT *));
|
||||
static int stdin_redirection __P((enum r_instruction, int));
|
||||
***************
|
||||
*** 94,97 ****
|
||||
--- 95,105 ----
|
||||
static int heredoc_errno;
|
||||
|
||||
+ #define REDIRECTION_ERROR(r, e) \
|
||||
+ if ((r) != 0) \
|
||||
+ { \
|
||||
+ last_command_exit_value = EXECUTION_FAILURE;\
|
||||
+ return ((e) == 0 ? EINVAL : (e));\
|
||||
+ }
|
||||
+
|
||||
void
|
||||
redirection_error (temp, error)
|
||||
***************
|
||||
*** 814,820 ****
|
||||
/* Only setup to undo it if the thing to undo is active. */
|
||||
if ((fd != redirector) && (fcntl (redirector, F_GETFD, 0) != -1))
|
||||
! add_undo_redirect (redirector, ri, -1);
|
||||
else
|
||||
! add_undo_close_redirect (redirector);
|
||||
}
|
||||
|
||||
--- 822,829 ----
|
||||
/* Only setup to undo it if the thing to undo is active. */
|
||||
if ((fd != redirector) && (fcntl (redirector, F_GETFD, 0) != -1))
|
||||
! r = add_undo_redirect (redirector, ri, -1);
|
||||
else
|
||||
! r = add_undo_close_redirect (redirector);
|
||||
! REDIRECTION_ERROR (r, errno);
|
||||
}
|
||||
|
||||
***************
|
||||
*** 919,925 ****
|
||||
/* Only setup to undo it if the thing to undo is active. */
|
||||
if ((fd != redirector) && (fcntl (redirector, F_GETFD, 0) != -1))
|
||||
! add_undo_redirect (redirector, ri, -1);
|
||||
else
|
||||
! add_undo_close_redirect (redirector);
|
||||
}
|
||||
|
||||
--- 928,935 ----
|
||||
/* Only setup to undo it if the thing to undo is active. */
|
||||
if ((fd != redirector) && (fcntl (redirector, F_GETFD, 0) != -1))
|
||||
! r = add_undo_redirect (redirector, ri, -1);
|
||||
else
|
||||
! r = add_undo_close_redirect (redirector);
|
||||
! REDIRECTION_ERROR(r, errno);
|
||||
}
|
||||
|
||||
***************
|
||||
*** 973,979 ****
|
||||
/* Only setup to undo it if the thing to undo is active. */
|
||||
if (fcntl (redirector, F_GETFD, 0) != -1)
|
||||
! add_undo_redirect (redirector, ri, redir_fd);
|
||||
else
|
||||
! add_undo_close_redirect (redirector);
|
||||
}
|
||||
#if defined (BUFFERED_INPUT)
|
||||
--- 983,990 ----
|
||||
/* Only setup to undo it if the thing to undo is active. */
|
||||
if (fcntl (redirector, F_GETFD, 0) != -1)
|
||||
! r = add_undo_redirect (redirector, ri, redir_fd);
|
||||
else
|
||||
! r = add_undo_close_redirect (redirector);
|
||||
! REDIRECTION_ERROR(r, errno);
|
||||
}
|
||||
#if defined (BUFFERED_INPUT)
|
||||
***************
|
||||
*** 1047,1052 ****
|
||||
}
|
||||
|
||||
if ((flags & RX_UNDOABLE) && (fcntl (redirector, F_GETFD, 0) != -1))
|
||||
! add_undo_redirect (redirector, ri, -1);
|
||||
|
||||
#if defined (COPROCESS_SUPPORT)
|
||||
--- 1058,1065 ----
|
||||
}
|
||||
|
||||
+ r = 0;
|
||||
if ((flags & RX_UNDOABLE) && (fcntl (redirector, F_GETFD, 0) != -1))
|
||||
! r = add_undo_redirect (redirector, ri, -1);
|
||||
! REDIRECTION_ERROR (r, errno);
|
||||
|
||||
#if defined (COPROCESS_SUPPORT)
|
||||
***************
|
||||
*** 1165,1169 ****
|
||||
/* Set up to close FD when we are finished with the current command
|
||||
and its redirections. */
|
||||
! static void
|
||||
add_undo_close_redirect (fd)
|
||||
int fd;
|
||||
--- 1178,1182 ----
|
||||
/* Set up to close FD when we are finished with the current command
|
||||
and its redirections. */
|
||||
! static int
|
||||
add_undo_close_redirect (fd)
|
||||
int fd;
|
||||
***************
|
||||
*** 1178,1181 ****
|
||||
--- 1191,1196 ----
|
||||
closer->next = redirection_undo_list;
|
||||
redirection_undo_list = closer;
|
||||
+
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
+2273
File diff suppressed because it is too large
Load Diff
+2273
File diff suppressed because it is too large
Load Diff
+1903
-1896
File diff suppressed because it is too large
Load Diff
+2
-2
@@ -9366,8 +9366,8 @@ is
|
||||
.BR RETURN ,
|
||||
the command
|
||||
.I arg
|
||||
is executed each time a shell function or a script executed with the
|
||||
\fB.\fP or \fBsource\fP builtins finishes executing.
|
||||
is executed each time a shell function or a script executed with
|
||||
the \fB.\fP or \fBsource\fP builtins finishes executing.
|
||||
.if t .sp 0.5
|
||||
.if n .sp 1
|
||||
If a
|
||||
|
||||
+64
-52
@@ -3,7 +3,7 @@
|
||||
</HEAD>
|
||||
<BODY><TABLE WIDTH=100%>
|
||||
<TR>
|
||||
<TH ALIGN=LEFT width=33%>BASH(1)<TH ALIGN=CENTER width=33%>2010 July 21<TH ALIGN=RIGHT width=33%>BASH(1)
|
||||
<TH ALIGN=LEFT width=33%>BASH(1)<TH ALIGN=CENTER width=33%>2010 September 6<TH ALIGN=RIGHT width=33%>BASH(1)
|
||||
</TR>
|
||||
</TABLE>
|
||||
<BR><A HREF="#index">Index</A>
|
||||
@@ -530,7 +530,7 @@ No other startup files are read.
|
||||
<B>Bash</B>
|
||||
|
||||
attempts to determine when it is being run with its standard input
|
||||
connected to a a network connection, as if by the remote shell
|
||||
connected to a network connection, as when executed by the remote shell
|
||||
daemon, usually <I>rshd</I>, or the secure shell daemon <I>sshd</I>.
|
||||
If
|
||||
<B>bash</B>
|
||||
@@ -1200,7 +1200,7 @@ command (see
|
||||
below).
|
||||
The file descriptors can be utilized as arguments to shell commands
|
||||
and redirections using standard word expansions.
|
||||
The process id of the shell spawned to execute the coprocess is
|
||||
The process ID of the shell spawned to execute the coprocess is
|
||||
available as the value of the variable <I>NAME</I>_PID.
|
||||
The <B>wait</B>
|
||||
builtin command may be used to wait for the coprocess to terminate.
|
||||
@@ -1572,7 +1572,7 @@ builtin commands.
|
||||
In the context where an assignment statement is assigning a value
|
||||
to a shell variable or array index, the += operator can be used to
|
||||
append to or add to the variable's previous value.
|
||||
When += is applied to a variable for which the integer attribute has been
|
||||
When += is applied to a variable for which the <I>integer</I> attribute has been
|
||||
set, <I>value</I> is evaluated as an arithmetic expression and added to the
|
||||
variable's current value, which is also evaluated.
|
||||
When += is applied to an array variable using compound assignment (see
|
||||
@@ -1784,7 +1784,7 @@ This variable is read-only.
|
||||
<DT><B>BASHPID</B>
|
||||
|
||||
<DD>
|
||||
Expands to the process id of the current <B>bash</B> process.
|
||||
Expands to the process ID of the current <B>bash</B> process.
|
||||
This differs from <B>$$</B> under certain circumstances, such as subshells
|
||||
that do not require <B>bash</B> to be re-initialized.
|
||||
<DT><B>BASH_ALIASES</B>
|
||||
@@ -2421,7 +2421,7 @@ If <B>bash</B> finds this variable in the environment when the shell starts
|
||||
with value
|
||||
<TT>t</TT>,
|
||||
|
||||
it assumes that the shell is running in an emacs shell buffer and disables
|
||||
it assumes that the shell is running in an Emacs shell buffer and disables
|
||||
line editing.
|
||||
<DT><B>ENV</B>
|
||||
|
||||
@@ -2704,14 +2704,15 @@ for printing selection lists. Automatically set upon receipt of a
|
||||
<DT><B>MAIL</B>
|
||||
|
||||
<DD>
|
||||
If this parameter is set to a file name and the
|
||||
If this parameter is set to a file or directory name and the
|
||||
<FONT SIZE=-1><B>MAILPATH</B>
|
||||
|
||||
</FONT>
|
||||
variable is not set,
|
||||
<B>bash</B>
|
||||
|
||||
informs the user of the arrival of mail in the specified file.
|
||||
informs the user of the arrival of mail in the specified file or
|
||||
Maildir-format directory.
|
||||
<DT><B>MAILCHECK</B>
|
||||
|
||||
<DD>
|
||||
@@ -2947,8 +2948,8 @@ not arrive.
|
||||
<DT><B>TMPDIR</B>
|
||||
|
||||
<DD>
|
||||
If set, <B>Bash</B> uses its value as the name of a directory in which
|
||||
<B>Bash</B> creates temporary files for the shell's use.
|
||||
If set, <B>bash</B> uses its value as the name of a directory in which
|
||||
<B>bash</B> creates temporary files for the shell's use.
|
||||
<DT><B>auto_resume</B>
|
||||
|
||||
<DD>
|
||||
@@ -3438,7 +3439,7 @@ a level of variable indirection is introduced.
|
||||
expanded and that value is used in the rest of the substitution, rather
|
||||
than the value of <I>parameter</I> itself.
|
||||
This is known as <I>indirect expansion</I>.
|
||||
The exceptions to this are the expansions of ${!<I>prefix</I>*} and
|
||||
The exceptions to this are the expansions of ${<B>!\fPfIprefix</B><B>*</B>} and
|
||||
${<B>!</B><I>name</I>[<I>@</I>]} described below.
|
||||
The exclamation point must immediately follow the left brace in order to
|
||||
introduce indirection.
|
||||
@@ -3507,7 +3508,7 @@ is substituted.
|
||||
|
||||
<DT>${<I>parameter</I><B>:</B><I>offset</I><B>:</B><I>length</I>}<DD>
|
||||
|
||||
<B>Substring Expansion.</B>
|
||||
<B>Substring Expansion</B>.
|
||||
Expands to up to <I>length</I> characters of <I>parameter</I>
|
||||
starting at the character specified by <I>offset</I>.
|
||||
If <I>length</I> is omitted, expands to the substring of
|
||||
@@ -3543,7 +3544,7 @@ prefixed to the list.
|
||||
|
||||
<DT>${<B>!</B><I>prefix</I><B>@</B>}<DD>
|
||||
|
||||
<B>Names matching prefix.</B>
|
||||
<B>Names matching prefix</B>.
|
||||
Expands to the names of variables whose names begin with <I>prefix</I>,
|
||||
separated by the first character of the
|
||||
<FONT SIZE=-1><B>IFS</B>
|
||||
@@ -3556,7 +3557,7 @@ variable name expands to a separate word.
|
||||
|
||||
<DT>${<B>!</B><I>name</I>[<I>*</I>]}<DD>
|
||||
|
||||
<B>List of array keys.</B>
|
||||
<B>List of array keys</B>.
|
||||
If <I>name</I> is an array variable, expands to the list of array indices
|
||||
(keys) assigned in <I>name</I>.
|
||||
If <I>name</I> is not an array, expands to 0 if <I>name</I> is set and null
|
||||
@@ -3564,7 +3565,7 @@ otherwise.
|
||||
When <I>@</I> is used and the expansion appears within double quotes, each
|
||||
key expands to a separate word.
|
||||
<DT>${<B>#</B><I>parameter</I>}<DD>
|
||||
<B>Parameter length.</B>
|
||||
<B>Parameter length</B>.
|
||||
The length in characters of the value of <I>parameter</I> is substituted.
|
||||
If
|
||||
<I>parameter</I>
|
||||
@@ -3590,7 +3591,7 @@ the value substituted is the number of elements in the array.
|
||||
|
||||
<DT>${<I>parameter</I><B>##</B><I>word</I>}<DD>
|
||||
|
||||
<B>Remove matching prefix pattern.</B>
|
||||
<B>Remove matching prefix pattern</B>.
|
||||
The
|
||||
<I>word</I>
|
||||
|
||||
@@ -3630,7 +3631,7 @@ array in turn, and the expansion is the resultant list.
|
||||
|
||||
<DT>${<I>parameter</I><B>%%</B><I>word</I>}<DD>
|
||||
|
||||
<B>Remove matching suffix pattern.</B>
|
||||
<B>Remove matching suffix pattern</B>.
|
||||
The <I>word</I> is expanded to produce a pattern just as in
|
||||
pathname expansion.
|
||||
If the pattern matches a trailing portion of the expanded value of
|
||||
@@ -3664,7 +3665,7 @@ or
|
||||
the pattern removal operation is applied to each member of the
|
||||
array in turn, and the expansion is the resultant list.
|
||||
<DT>${<I>parameter</I><B>/</B><I>pattern</I><B>/</B><I>string</I>}<DD>
|
||||
<B>Pattern substitution.</B>
|
||||
<B>Pattern substitution</B>.
|
||||
The <I>pattern</I> is expanded to produce a pattern just as in
|
||||
pathname expansion.
|
||||
<I>Parameter</I> is expanded and the longest match of <I>pattern</I>
|
||||
@@ -3705,7 +3706,7 @@ array in turn, and the expansion is the resultant list.
|
||||
<DT>${<I>parameter</I><B>,</B><I>pattern</I>}<DD>
|
||||
<DT>${<I>parameter</I><B>,,</B><I>pattern</I>}<DD>
|
||||
|
||||
<B>Case modification.</B>
|
||||
<B>Case modification</B>.
|
||||
This expansion modifies the case of alphabetic characters in <I>parameter</I>.
|
||||
The <I>pattern</I> is expanded to produce a pattern just as in
|
||||
pathname expansion.
|
||||
@@ -4885,7 +4886,7 @@ during its execution.
|
||||
The special parameter
|
||||
<B>#</B>
|
||||
|
||||
is updated to reflect the change. Special parameter 0
|
||||
is updated to reflect the change. Special parameter <B>0</B>
|
||||
is unchanged.
|
||||
The first element of the
|
||||
<FONT SIZE=-1><B>FUNCNAME</B>
|
||||
@@ -5104,7 +5105,7 @@ The value of a variable is evaluated as an arithmetic expression
|
||||
when it is referenced, or when a variable which has been given the
|
||||
<I>integer</I> attribute using <B>declare -i</B> is assigned a value.
|
||||
A null value evaluates to 0.
|
||||
A shell variable need not have its integer attribute
|
||||
A shell variable need not have its <I>integer</I> attribute
|
||||
turned on to be used in an expression.
|
||||
<P>
|
||||
|
||||
@@ -5530,8 +5531,8 @@ cannot affect the shell's execution environment.
|
||||
<P>
|
||||
|
||||
Subshells spawned to execute command substitutions inherit the value of
|
||||
the <B>-e</B> option from the parent shell. When not in posix mode,
|
||||
Bash clears the <B>-e</B> option in such subshells.
|
||||
the <B>-e</B> option from the parent shell. When not in <I>posix</I> mode,
|
||||
<B>bash</B> clears the <B>-e</B> option in such subshells.
|
||||
<P>
|
||||
|
||||
If a command is followed by a <B>&</B> and job control is not active, the
|
||||
@@ -6196,7 +6197,7 @@ shell, unless the
|
||||
option is given at shell invocation.
|
||||
Line editing is also used when using the <B>-e</B> option to the
|
||||
<B>read</B> builtin.
|
||||
By default, the line editing commands are similar to those of emacs.
|
||||
By default, the line editing commands are similar to those of Emacs.
|
||||
A vi-style line editing interface is also available.
|
||||
Line editing can be enabled at any time using the
|
||||
<B>-o emacs</B>
|
||||
@@ -6227,7 +6228,7 @@ builtin.
|
||||
|
||||
<P>
|
||||
|
||||
In this section, the emacs-style notation is used to denote
|
||||
In this section, the Emacs-style notation is used to denote
|
||||
keystrokes. Control keys are denoted by C-<I>key</I>, e.g., C-n
|
||||
means Control-N. Similarly,
|
||||
<I>meta</I>
|
||||
@@ -6655,7 +6656,7 @@ mapped to <B>self-insert</B>.
|
||||
|
||||
<DD>
|
||||
Controls whether readline begins with a set of key bindings similar
|
||||
to <I>emacs</I> or <I>vi</I>.
|
||||
to <I>Emacs</I> or <I>vi</I>.
|
||||
<B>editing-mode</B>
|
||||
|
||||
can be set to either
|
||||
@@ -6685,12 +6686,12 @@ the meta key is used to send eight-bit characters.
|
||||
<DT><B>expand-tilde (Off)</B>
|
||||
|
||||
<DD>
|
||||
If set to <B>on</B>, tilde expansion is performed when readline
|
||||
If set to <B>On</B>, tilde expansion is performed when readline
|
||||
attempts word completion.
|
||||
<DT><B>history-preserve-point (Off)</B>
|
||||
|
||||
<DD>
|
||||
If set to <B>on</B>, the history code attempts to place point at the
|
||||
If set to <B>On</B>, the history code attempts to place point at the
|
||||
same location on each history line retrieved with <B>previous-history</B>
|
||||
or <B>next-history</B>.
|
||||
<DT><B>history-size (0)</B>
|
||||
@@ -6760,6 +6761,12 @@ names begin with a `.' (hidden files) when performing filename
|
||||
completion.
|
||||
If set to <B>Off</B>, the leading `.' must be
|
||||
supplied by the user in the filename to be completed.
|
||||
<DT><B>menu-complete-display-prefix (Off)</B>
|
||||
|
||||
<DD>
|
||||
If set to <B>On</B>, menu completion displays the common prefix of the
|
||||
list of possible completions (which may be empty) before cycling through
|
||||
the list.
|
||||
<DT><B>output-meta (Off)</B>
|
||||
|
||||
<DD>
|
||||
@@ -6779,7 +6786,7 @@ sorted horizontally in alphabetical order, rather than down the screen.
|
||||
<DT><B>revert-all-at-newline (Off)</B>
|
||||
|
||||
<DD>
|
||||
If set to <B>on</B>, readline will undo all changes to history lines
|
||||
If set to <B>On</B>, readline will undo all changes to history lines
|
||||
before returning when <B>accept-line</B> is executed. By default,
|
||||
history lines may be modified and retain individual undo lists across
|
||||
calls to <B>readline</B>.
|
||||
@@ -6788,7 +6795,7 @@ calls to <B>readline</B>.
|
||||
<DD>
|
||||
This alters the default behavior of the completion functions. If
|
||||
set to
|
||||
<B>on</B>,
|
||||
<B>On</B>,
|
||||
|
||||
words which have more than one possible completion cause the
|
||||
matches to be listed immediately instead of ringing the bell.
|
||||
@@ -6798,7 +6805,7 @@ matches to be listed immediately instead of ringing the bell.
|
||||
This alters the default behavior of the completion functions in
|
||||
a fashion similar to <B>show-all-if-ambiguous</B>.
|
||||
If set to
|
||||
<B>on</B>,
|
||||
<B>On</B>,
|
||||
|
||||
words which have more than one possible completion without any
|
||||
possible partial completion (the possible completions don't share
|
||||
@@ -6872,7 +6879,7 @@ library sets the <I>application name</I>, and an initialization
|
||||
file can test for a particular value.
|
||||
This could be used to bind key sequences to functions useful for
|
||||
a specific program. For instance, the following command adds a
|
||||
key sequence that quotes the current or previous word in Bash:
|
||||
key sequence that quotes the current or previous word in <B>bash</B>:
|
||||
<P>
|
||||
<DL COMPACT><DT><DD>
|
||||
<PRE>
|
||||
@@ -7435,7 +7442,7 @@ of matches; a negative argument may be used to move backward
|
||||
through the list.
|
||||
This command is intended to be bound to <B>TAB</B>, but is unbound
|
||||
by default.
|
||||
<DT><B>menu-complete-rd</B>
|
||||
<DT><B>menu-complete-backward</B>
|
||||
|
||||
<DD>
|
||||
Identical to <B>menu-complete</B>, but moves backward through the list
|
||||
@@ -7617,7 +7624,7 @@ character. A negative count searches for previous occurrences.
|
||||
<DD>
|
||||
A character is read and point is moved to the previous occurrence of that
|
||||
character. A negative count searches for subsequent occurrences.
|
||||
<DT><B>skip-csi-sequence ()</B>
|
||||
<DT><B>skip-csi-sequence</B>
|
||||
|
||||
<DD>
|
||||
Read enough characters to consume a multi-key sequence such as those
|
||||
@@ -7720,7 +7727,7 @@ If the command word is a full pathname, a compspec for the full
|
||||
pathname is searched for first.
|
||||
If no compspec is found for the full pathname, an attempt is made to
|
||||
find a compspec for the portion following the final slash.
|
||||
If those searches to not result in a compspec, any compspec defined with
|
||||
If those searches do not result in a compspec, any compspec defined with
|
||||
the <B>-D</B> option to <B>complete</B> is used as the default.
|
||||
<P>
|
||||
|
||||
@@ -8199,6 +8206,8 @@ writing the history file.
|
||||
|
||||
An event designator is a reference to a command line entry in the
|
||||
history list.
|
||||
Unless the reference is absolute, events are relative to the current
|
||||
position in the history list.
|
||||
<P>
|
||||
|
||||
|
||||
@@ -8221,7 +8230,7 @@ Refer to command line
|
||||
<DT><B>!-</B><I>n</I>
|
||||
|
||||
<DD>
|
||||
Refer to the current command line minus
|
||||
Refer to the current command minus
|
||||
<I>n</I>.
|
||||
|
||||
<DT><B>!!</B>
|
||||
@@ -8231,13 +8240,15 @@ Refer to the previous command. This is a synonym for `!-1'.
|
||||
<DT><B>!</B><I>string</I>
|
||||
|
||||
<DD>
|
||||
Refer to the most recent command starting with
|
||||
Refer to the most recent command preceding the current position in the
|
||||
history list starting with
|
||||
<I>string</I>.
|
||||
|
||||
<DT><B>!?</B><I>string</I><B>[?]</B>
|
||||
|
||||
<DD>
|
||||
Refer to the most recent command containing
|
||||
Refer to the most recent command preceding the current postition in the
|
||||
history list containing
|
||||
<I>string</I>.
|
||||
|
||||
The trailing <B>?</B> may be omitted if
|
||||
@@ -8247,7 +8258,7 @@ is followed immediately by a newline.
|
||||
<DT><B></B><FONT SIZE=+2><B>^</B></FONT><B></B><I>string1</I><FONT SIZE=+2>^</FONT><I>string2</I><FONT SIZE=+2>^</FONT>
|
||||
|
||||
<DD>
|
||||
Quick substitution. Repeat the last command, replacing
|
||||
Quick substitution. Repeat the previous command, replacing
|
||||
<I>string1</I>
|
||||
|
||||
with
|
||||
@@ -9826,7 +9837,7 @@ return value greater than zero.
|
||||
|
||||
</FONT>
|
||||
is set to the index of the first non-option argument,
|
||||
and <B>name</B> is set to ?.
|
||||
and <I>name</I> is set to ?.
|
||||
<P>
|
||||
<B>getopts</B>
|
||||
|
||||
@@ -10750,9 +10761,9 @@ function and not during execution of a script by <B>.</B>,
|
||||
the return status is false.
|
||||
Any command associated with the <B>RETURN</B> trap is executed
|
||||
before execution resumes after the function or script.
|
||||
<DT><B>set</B> [<B>--abefhkmnptuvxBCEHPT</B>] [<B>-o</B> <I>option</I>] [<I>arg</I> ...]<DD>
|
||||
<DT><B>set</B> [<B>--abefhkmnptuvxBCEHPT</B>] [<B>-o</B> <I>option-name</I>] [<I>arg</I> ...]<DD>
|
||||
|
||||
<DT><B>set</B> [<B>+abefhkmnptuvxBCEHPT</B>] [<B>+o</B> <I>option</I>] [<I>arg</I> ...]<DD>
|
||||
<DT><B>set</B> [<B>+abefhkmnptuvxBCEHPT</B>] [<B>+o</B> <I>option-name</I>] [<I>arg</I> ...]<DD>
|
||||
|
||||
Without options, the name and value of each shell variable are displayed
|
||||
in a format that can be reused as input
|
||||
@@ -11390,7 +11401,7 @@ If set,
|
||||
<B>bash</B>
|
||||
|
||||
changes its behavior to that of version 3.1 with respect to quoted
|
||||
arguments to the conditional command's =~ operator.
|
||||
arguments to the conditional command's <B>=~</B> operator.
|
||||
<DT><B>compat32</B>
|
||||
|
||||
<DD>
|
||||
@@ -11398,7 +11409,8 @@ If set,
|
||||
<B>bash</B>
|
||||
|
||||
changes its behavior to that of version 3.2 with respect to locale-specific
|
||||
string comparison when using the conditional command's < and > operators.
|
||||
string comparison when using the conditional command's <B><</B> and <B>></B>
|
||||
operators.
|
||||
<DT><B>compat40</B>
|
||||
|
||||
<DD>
|
||||
@@ -11406,8 +11418,8 @@ If set,
|
||||
<B>bash</B>
|
||||
|
||||
changes its behavior to that of version 4.0 with respect to locale-specific
|
||||
string comparison when using the conditional command's < and > operators
|
||||
and the effect of interrupting a command list.
|
||||
string comparison when using the conditional command's <B><</B> and <B>></B>
|
||||
operators and the effect of interrupting a command list.
|
||||
<DT><B>compat41</B>
|
||||
|
||||
<DD>
|
||||
@@ -11958,8 +11970,8 @@ is
|
||||
the command
|
||||
<I>arg</I>
|
||||
|
||||
is executed each time a shell function or a script executed with the
|
||||
<B>.</B> or <B>source</B> builtins finishes executing.
|
||||
is executed each time a shell function or a script executed with
|
||||
the <B>.</B> or <B>source</B> builtins finishes executing.
|
||||
<P>
|
||||
|
||||
|
||||
@@ -12432,7 +12444,7 @@ as an argument to the
|
||||
|
||||
builtin command
|
||||
<DT>*<DD>
|
||||
Specifying a filename containing a slash as an argument to the
|
||||
specifying a filename containing a slash as an argument to the
|
||||
<B>-p</B>
|
||||
|
||||
option to the
|
||||
@@ -12466,7 +12478,7 @@ options to the
|
||||
|
||||
builtin command
|
||||
<DT>*<DD>
|
||||
Using the <B>enable</B> builtin command to enable disabled shell builtins
|
||||
using the <B>enable</B> builtin command to enable disabled shell builtins
|
||||
<DT>*<DD>
|
||||
specifying the
|
||||
<B>-p</B>
|
||||
@@ -12660,7 +12672,7 @@ There may be only one active coprocess at a time.
|
||||
<HR>
|
||||
<TABLE WIDTH=100%>
|
||||
<TR>
|
||||
<TH ALIGN=LEFT width=33%>GNU Bash-4.2<TH ALIGN=CENTER width=33%>2010 July 21<TH ALIGN=RIGHT width=33%>BASH(1)
|
||||
<TH ALIGN=LEFT width=33%>GNU Bash-4.2<TH ALIGN=CENTER width=33%>2010 September 6<TH ALIGN=RIGHT width=33%>BASH(1)
|
||||
</TR>
|
||||
</TABLE>
|
||||
<HR>
|
||||
@@ -12766,6 +12778,6 @@ There may be only one active coprocess at a time.
|
||||
</DL>
|
||||
<HR>
|
||||
This document was created by man2html from bash.1.<BR>
|
||||
Time: 21 July 2010 08:54:57 EDT
|
||||
Time: 25 October 2010 12:00:43 EDT
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
Binary file not shown.
+2189
-2177
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+385
-376
File diff suppressed because it is too large
Load Diff
+194
-190
@@ -2,9 +2,9 @@ This is bashref.info, produced by makeinfo version 4.13 from
|
||||
/Users/chet/src/bash/src/doc/bashref.texi.
|
||||
|
||||
This text is a brief description of the features that are present in
|
||||
the Bash shell (version 4.2, 21 July 2010).
|
||||
the Bash shell (version 4.2, 20 October 2010).
|
||||
|
||||
This is Edition 4.2, last updated 21 July 2010, of `The GNU Bash
|
||||
This is Edition 4.2, last updated 20 October 2010, of `The GNU Bash
|
||||
Reference Manual', for `Bash', Version 4.2.
|
||||
|
||||
Copyright (C) 1988-2010 Free Software Foundation, Inc.
|
||||
@@ -38,9 +38,9 @@ Bash Features
|
||||
*************
|
||||
|
||||
This text is a brief description of the features that are present in
|
||||
the Bash shell (version 4.2, 21 July 2010).
|
||||
the Bash shell (version 4.2, 20 October 2010).
|
||||
|
||||
This is Edition 4.2, last updated 21 July 2010, of `The GNU Bash
|
||||
This is Edition 4.2, last updated 20 October 2010, of `The GNU Bash
|
||||
Reference Manual', for `Bash', Version 4.2.
|
||||
|
||||
Bash contains features that appear in other popular shells, and some
|
||||
@@ -994,7 +994,7 @@ by the command (*note Redirections::). The file descriptors can be
|
||||
utilized as arguments to shell commands and redirections using standard
|
||||
word expansions.
|
||||
|
||||
The process id of the shell spawned to execute the coprocess is
|
||||
The process ID of the shell spawned to execute the coprocess is
|
||||
available as the value of the variable NAME_PID. The `wait' builtin
|
||||
command may be used to wait for the coprocess to terminate.
|
||||
|
||||
@@ -1193,7 +1193,7 @@ and `local' builtin commands.
|
||||
In the context where an assignment statement is assigning a value to
|
||||
a shell variable or array index (*note Arrays::), the `+=' operator can
|
||||
be used to append to or add to the variable's previous value. When
|
||||
`+=' is applied to a variable for which the integer attribute has been
|
||||
`+=' is applied to a variable for which the INTEGER attribute has been
|
||||
set, VALUE is evaluated as an arithmetic expression and added to the
|
||||
variable's current value, which is also evaluated. When `+=' is
|
||||
applied to an array variable using compound assignment (*note
|
||||
@@ -1496,9 +1496,9 @@ the variable formed from the rest of PARAMETER as the name of the
|
||||
variable; this variable is then expanded and that value is used in the
|
||||
rest of the substitution, rather than the value of PARAMETER itself.
|
||||
This is known as `indirect expansion'. The exceptions to this are the
|
||||
expansions of ${!PREFIX*} and ${!NAME[@]} described below. The
|
||||
exclamation point must immediately follow the left brace in order to
|
||||
introduce indirection.
|
||||
expansions of ${!PREFIX
|
||||
} and ${!NAME[@]} described below. The exclamation point must
|
||||
immediately follow the left brace in order to introduce indirection.
|
||||
|
||||
In each of the cases below, WORD is subject to tilde expansion,
|
||||
parameter expansion, command substitution, and arithmetic expansion.
|
||||
@@ -2637,7 +2637,7 @@ standard.
|
||||
|
||||
When the end of options is encountered, `getopts' exits with a
|
||||
return value greater than zero. `OPTIND' is set to the index of
|
||||
the first non-option argument, and `name' is set to `?'.
|
||||
the first non-option argument, and NAME is set to `?'.
|
||||
|
||||
`getopts' normally parses the positional parameters, but if more
|
||||
arguments are given in ARGS, `getopts' parses those instead.
|
||||
@@ -3568,8 +3568,8 @@ allows you to change the values of shell options and set the positional
|
||||
parameters, or to display the names and values of shell variables.
|
||||
|
||||
`set'
|
||||
set [--abefhkmnptuvxBCEHPT] [-o OPTION] [ARGUMENT ...]
|
||||
set [+abefhkmnptuvxBCEHPT] [+o OPTION] [ARGUMENT ...]
|
||||
set [--abefhkmnptuvxBCEHPT] [-o OPTION-NAME] [ARGUMENT ...]
|
||||
set [+abefhkmnptuvxBCEHPT] [+o OPTION-NAME] [ARGUMENT ...]
|
||||
|
||||
If no options or arguments are supplied, `set' displays the names
|
||||
and values of all shell variables and functions, sorted according
|
||||
@@ -3911,18 +3911,18 @@ This builtin allows you to change additional shell optional behavior.
|
||||
|
||||
`compat31'
|
||||
If set, Bash changes its behavior to that of version 3.1 with
|
||||
respect to quoted arguments to the conditional command's =~
|
||||
respect to quoted arguments to the conditional command's `=~'
|
||||
operator.
|
||||
|
||||
`compat32'
|
||||
If set, Bash changes its behavior to that of version 3.2 with
|
||||
respect to locale-specific string comparison when using the
|
||||
conditional command's < and > operators.
|
||||
conditional command's `<' and `>' operators.
|
||||
|
||||
`compat40'
|
||||
If set, Bash changes its behavior to that of version 4.0 with
|
||||
respect to locale-specific string comparison when using the
|
||||
conditional command's < and > operators and the effect of
|
||||
conditional command's `<' and `>' operators and the effect of
|
||||
interrupting a command list.
|
||||
|
||||
`compat41'
|
||||
@@ -4183,9 +4183,9 @@ In some cases, Bash assigns a default value to the variable.
|
||||
splits words as part of expansion.
|
||||
|
||||
`MAIL'
|
||||
If this parameter is set to a filename and the `MAILPATH' variable
|
||||
is not set, Bash informs the user of the arrival of mail in the
|
||||
specified file.
|
||||
If this parameter is set to a filename or directory name and the
|
||||
`MAILPATH' variable is not set, Bash informs the user of the
|
||||
arrival of mail in the specified file or Maildir-format directory.
|
||||
|
||||
`MAILPATH'
|
||||
A colon-separated list of filenames which the shell periodically
|
||||
@@ -4243,13 +4243,13 @@ Variables::).
|
||||
startup files. This variable is readonly.
|
||||
|
||||
`BASHPID'
|
||||
Expands to the process id of the current Bash process. This
|
||||
Expands to the process ID of the current Bash process. This
|
||||
differs from `$$' under certain circumstances, such as subshells
|
||||
that do not require Bash to be re-initialized.
|
||||
|
||||
`BASH_ALIASES'
|
||||
An associative array variable whose members correspond to the
|
||||
internal list of aliases as maintained by the `alias' builtin
|
||||
internal list of aliases as maintained by the `alias' builtin.
|
||||
(*note Bourne Shell Builtins::). Elements added to this array
|
||||
appear in the alias list; unsetting array elements cause aliases
|
||||
to be removed from the alias list.
|
||||
@@ -4434,7 +4434,7 @@ Variables::).
|
||||
`EMACS'
|
||||
If Bash finds this variable in the environment when the shell
|
||||
starts with value `t', it assumes that the shell is running in an
|
||||
emacs shell buffer and disables line editing.
|
||||
Emacs shell buffer and disables line editing.
|
||||
|
||||
`ENV'
|
||||
Similar to `BASH_ENV'; used when the shell is invoked in POSIX
|
||||
@@ -5064,14 +5064,14 @@ Invoked by remote shell daemon
|
||||
..............................
|
||||
|
||||
Bash attempts to determine when it is being run with its standard input
|
||||
connected to a a network connection, as if by the remote shell daemon,
|
||||
usually `rshd', or the secure shell daemon `sshd'. If Bash determines
|
||||
it is being run in this fashion, it reads and executes commands from
|
||||
`~/.bashrc', if that file exists and is readable. It will not do this
|
||||
if invoked as `sh'. The `--norc' option may be used to inhibit this
|
||||
behavior, and the `--rcfile' option may be used to force another file
|
||||
to be read, but `rshd' does not generally invoke the shell with those
|
||||
options or allow them to be specified.
|
||||
connected to a network connection, as when executed by the remote shell
|
||||
daemon, usually `rshd', or the secure shell daemon `sshd'. If Bash
|
||||
determines it is being run in this fashion, it reads and executes
|
||||
commands from `~/.bashrc', if that file exists and is readable. It
|
||||
will not do this if invoked as `sh'. The `--norc' option may be used
|
||||
to inhibit this behavior, and the `--rcfile' option may be used to
|
||||
force another file to be read, but `rshd' does not generally invoke the
|
||||
shell with those options or allow them to be specified.
|
||||
|
||||
Invoked with unequal effective and real UID/GIDs
|
||||
................................................
|
||||
@@ -5436,7 +5436,7 @@ expansion syntax. The value of a variable is evaluated as an
|
||||
arithmetic expression when it is referenced, or when a variable which
|
||||
has been given the INTEGER attribute using `declare -i' is assigned a
|
||||
value. A null value evaluates to 0. A shell variable need not have
|
||||
its integer attribute turned on to be used in an expression.
|
||||
its INTEGER attribute turned on to be used in an expression.
|
||||
|
||||
Constants with a leading 0 are interpreted as octal numbers. A
|
||||
leading `0x' or `0X' denotes hexadecimal. Otherwise, numbers take the
|
||||
@@ -5954,17 +5954,15 @@ startup files.
|
||||
options, redirection errors, variable assignment errors for
|
||||
assignments preceding the command name, and so on.
|
||||
|
||||
23. If `CDPATH' is set, the `cd' builtin will not implicitly append
|
||||
the current directory to it. This means that `cd' will fail if no
|
||||
valid directory name can be constructed from any of the entries in
|
||||
`$CDPATH', even if the a directory with the same name as the name
|
||||
given as an argument to `cd' exists in the current directory.
|
||||
|
||||
24. A non-interactive shell exits with an error status if a variable
|
||||
23. A non-interactive shell exits with an error status if a variable
|
||||
assignment error occurs when no command name follows the assignment
|
||||
statements. A variable assignment error occurs, for example, when
|
||||
trying to assign a value to a readonly variable.
|
||||
|
||||
24. A non-interactive shell exists with an error status if a variable
|
||||
assignment error occurs in an assignment statement preceding a
|
||||
special builtin, but not with any other simple command.
|
||||
|
||||
25. A non-interactive shell exits with an error status if the iteration
|
||||
variable in a `for' statement or the selection variable in a
|
||||
`select' statement is a readonly variable.
|
||||
@@ -6015,35 +6013,32 @@ startup files.
|
||||
argument does not refer to an existing directory, `cd' will fail
|
||||
instead of falling back to PHYSICAL mode.
|
||||
|
||||
39. When the `pwd' builtin is supplied the `-P' option, it resets
|
||||
`$PWD' to a pathname containing no symlinks.
|
||||
|
||||
40. The `pwd' builtin verifies that the value it prints is the same as
|
||||
39. The `pwd' builtin verifies that the value it prints is the same as
|
||||
the current directory, even if it is not asked to check the file
|
||||
system with the `-P' option.
|
||||
|
||||
41. When listing the history, the `fc' builtin does not include an
|
||||
40. When listing the history, the `fc' builtin does not include an
|
||||
indication of whether or not a history entry has been modified.
|
||||
|
||||
42. The default editor used by `fc' is `ed'.
|
||||
41. The default editor used by `fc' is `ed'.
|
||||
|
||||
43. The `type' and `command' builtins will not report a non-executable
|
||||
42. The `type' and `command' builtins will not report a non-executable
|
||||
file as having been found, though the shell will attempt to
|
||||
execute such a file if it is the only so-named file found in
|
||||
`$PATH'.
|
||||
|
||||
44. The `vi' editing mode will invoke the `vi' editor directly when
|
||||
43. The `vi' editing mode will invoke the `vi' editor directly when
|
||||
the `v' command is run, instead of checking `$VISUAL' and
|
||||
`$EDITOR'.
|
||||
|
||||
45. When the `xpg_echo' option is enabled, Bash does not attempt to
|
||||
44. When the `xpg_echo' option is enabled, Bash does not attempt to
|
||||
interpret any arguments to `echo' as options. Each argument is
|
||||
displayed, after escape characters are converted.
|
||||
|
||||
46. The `ulimit' builtin uses a block size of 512 bytes for the `-c'
|
||||
45. The `ulimit' builtin uses a block size of 512 bytes for the `-c'
|
||||
and `-f' options.
|
||||
|
||||
47. The arrival of `SIGCHLD' when a trap is set on `SIGCHLD' does not
|
||||
46. The arrival of `SIGCHLD' when a trap is set on `SIGCHLD' does not
|
||||
interrupt the `wait' builtin and cause it to return immediately.
|
||||
The trap command is run once for each child that exits.
|
||||
|
||||
@@ -6308,7 +6303,7 @@ Command line editing is enabled by default when using an interactive
|
||||
shell, unless the `--noediting' option is supplied at shell invocation.
|
||||
Line editing is also used when using the `-e' option to the `read'
|
||||
builtin command (*note Bash Builtins::). By default, the line editing
|
||||
commands are similar to those of emacs. A vi-style line editing
|
||||
commands are similar to those of Emacs. A vi-style line editing
|
||||
interface is also available. Line editing can be enabled at any time
|
||||
using the `-o emacs' or `-o vi' options to the `set' builtin command
|
||||
(*note The Set Builtin::), or disabled using the `+o emacs' or `+o vi'
|
||||
@@ -6802,6 +6797,11 @@ Variable Settings
|
||||
`.' must be supplied by the user in the filename to be
|
||||
completed. This variable is `on' by default.
|
||||
|
||||
`menu-complete-display-prefix'
|
||||
If set to `on', menu completion displays the common prefix of
|
||||
the list of possible completions (which may be empty) before
|
||||
cycling through the list. The default is `off'.
|
||||
|
||||
`output-meta'
|
||||
If set to `on', Readline will display characters with the
|
||||
eighth bit set directly rather than as a meta-prefixed escape
|
||||
@@ -8341,7 +8341,8 @@ File: bashref.info, Node: Event Designators, Next: Word Designators, Up: Hist
|
||||
-----------------------
|
||||
|
||||
An event designator is a reference to a command line entry in the
|
||||
history list.
|
||||
history list. Unless the reference is absolute, events are relative to
|
||||
the current position in the history list.
|
||||
|
||||
`!'
|
||||
Start a history substitution, except when followed by a space, tab,
|
||||
@@ -8358,12 +8359,13 @@ history list.
|
||||
Refer to the previous command. This is a synonym for `!-1'.
|
||||
|
||||
`!STRING'
|
||||
Refer to the most recent command starting with STRING.
|
||||
Refer to the most recent command preceding the current position in
|
||||
the history list starting with STRING.
|
||||
|
||||
`!?STRING[?]'
|
||||
Refer to the most recent command containing STRING. The trailing
|
||||
`?' may be omitted if the STRING is followed immediately by a
|
||||
newline.
|
||||
Refer to the most recent command preceding the current position in
|
||||
the history list containing STRING. The trailing `?' may be
|
||||
omitted if the STRING is followed immediately by a newline.
|
||||
|
||||
`^STRING1^STRING2^'
|
||||
Quick Substitution. Repeat the last command, replacing STRING1
|
||||
@@ -10137,6 +10139,8 @@ D.3 Parameter and Variable Index
|
||||
(line 177)
|
||||
* match-hidden-files: Readline Init File Syntax.
|
||||
(line 182)
|
||||
* menu-complete-display-prefix: Readline Init File Syntax.
|
||||
(line 189)
|
||||
* meta-flag: Readline Init File Syntax.
|
||||
(line 145)
|
||||
* OLDPWD: Bash Variables. (line 436)
|
||||
@@ -10147,9 +10151,9 @@ D.3 Parameter and Variable Index
|
||||
(line 38)
|
||||
* OSTYPE: Bash Variables. (line 443)
|
||||
* output-meta: Readline Init File Syntax.
|
||||
(line 189)
|
||||
* page-completions: Readline Init File Syntax.
|
||||
(line 194)
|
||||
* page-completions: Readline Init File Syntax.
|
||||
(line 199)
|
||||
* PATH: Bourne Shell Variables.
|
||||
(line 42)
|
||||
* PIPESTATUS: Bash Variables. (line 446)
|
||||
@@ -10169,17 +10173,17 @@ D.3 Parameter and Variable Index
|
||||
* READLINE_POINT: Bash Variables. (line 497)
|
||||
* REPLY: Bash Variables. (line 501)
|
||||
* revert-all-at-newline: Readline Init File Syntax.
|
||||
(line 204)
|
||||
(line 209)
|
||||
* SECONDS: Bash Variables. (line 504)
|
||||
* SHELL: Bash Variables. (line 510)
|
||||
* SHELLOPTS: Bash Variables. (line 515)
|
||||
* SHLVL: Bash Variables. (line 524)
|
||||
* show-all-if-ambiguous: Readline Init File Syntax.
|
||||
(line 210)
|
||||
(line 215)
|
||||
* show-all-if-unmodified: Readline Init File Syntax.
|
||||
(line 216)
|
||||
(line 221)
|
||||
* skip-completed-text: Readline Init File Syntax.
|
||||
(line 225)
|
||||
(line 230)
|
||||
* TEXTDOMAIN: Locale Translation. (line 11)
|
||||
* TEXTDOMAINDIR: Locale Translation. (line 11)
|
||||
* TIMEFORMAT: Bash Variables. (line 529)
|
||||
@@ -10187,7 +10191,7 @@ D.3 Parameter and Variable Index
|
||||
* TMPDIR: Bash Variables. (line 579)
|
||||
* UID: Bash Variables. (line 583)
|
||||
* visible-stats: Readline Init File Syntax.
|
||||
(line 238)
|
||||
(line 243)
|
||||
|
||||
|
||||
File: bashref.info, Node: Function Index, Next: Concept Index, Prev: Variable Index, Up: Indexes
|
||||
@@ -10374,7 +10378,7 @@ D.5 Concept Index
|
||||
* functions, shell: Shell Functions. (line 6)
|
||||
* history builtins: Bash History Builtins.
|
||||
(line 6)
|
||||
* history events: Event Designators. (line 7)
|
||||
* history events: Event Designators. (line 8)
|
||||
* history expansion: History Interaction. (line 6)
|
||||
* history list: Bash History Facilities.
|
||||
(line 6)
|
||||
@@ -10456,133 +10460,133 @@ D.5 Concept Index
|
||||
|
||||
|
||||
Tag Table:
|
||||
Node: Top1338
|
||||
Node: Introduction3169
|
||||
Node: What is Bash?3397
|
||||
Node: What is a shell?4510
|
||||
Node: Definitions7050
|
||||
Node: Basic Shell Features9968
|
||||
Node: Shell Syntax11187
|
||||
Node: Shell Operation12217
|
||||
Node: Quoting13511
|
||||
Node: Escape Character14814
|
||||
Node: Single Quotes15299
|
||||
Node: Double Quotes15647
|
||||
Node: ANSI-C Quoting16772
|
||||
Node: Locale Translation18016
|
||||
Node: Comments18912
|
||||
Node: Shell Commands19530
|
||||
Node: Simple Commands20402
|
||||
Node: Pipelines21033
|
||||
Node: Lists23727
|
||||
Node: Compound Commands25456
|
||||
Node: Looping Constructs26260
|
||||
Node: Conditional Constructs28719
|
||||
Node: Command Grouping36832
|
||||
Node: Coprocesses38311
|
||||
Node: GNU Parallel39976
|
||||
Node: Shell Functions42444
|
||||
Node: Shell Parameters47388
|
||||
Node: Positional Parameters49804
|
||||
Node: Special Parameters50704
|
||||
Node: Shell Expansions53668
|
||||
Node: Brace Expansion55593
|
||||
Node: Tilde Expansion58348
|
||||
Node: Shell Parameter Expansion60699
|
||||
Node: Command Substitution69834
|
||||
Node: Arithmetic Expansion71167
|
||||
Node: Process Substitution72017
|
||||
Node: Word Splitting73067
|
||||
Node: Filename Expansion74690
|
||||
Node: Pattern Matching76829
|
||||
Node: Quote Removal80468
|
||||
Node: Redirections80763
|
||||
Node: Executing Commands89288
|
||||
Node: Simple Command Expansion89958
|
||||
Node: Command Search and Execution91888
|
||||
Node: Command Execution Environment94225
|
||||
Node: Environment97211
|
||||
Node: Exit Status98871
|
||||
Node: Signals100492
|
||||
Node: Shell Scripts102460
|
||||
Node: Shell Builtin Commands104978
|
||||
Node: Bourne Shell Builtins107006
|
||||
Node: Bash Builtins124684
|
||||
Node: Modifying Shell Behavior150898
|
||||
Node: The Set Builtin151243
|
||||
Node: The Shopt Builtin160767
|
||||
Node: Special Builtins172722
|
||||
Node: Shell Variables173701
|
||||
Node: Bourne Shell Variables174141
|
||||
Node: Bash Variables176122
|
||||
Node: Bash Features201046
|
||||
Node: Invoking Bash201929
|
||||
Node: Bash Startup Files207693
|
||||
Node: Interactive Shells212705
|
||||
Node: What is an Interactive Shell?213115
|
||||
Node: Is this Shell Interactive?213764
|
||||
Node: Interactive Shell Behavior214579
|
||||
Node: Bash Conditional Expressions217859
|
||||
Node: Shell Arithmetic221607
|
||||
Node: Aliases224366
|
||||
Node: Arrays226938
|
||||
Node: The Directory Stack231053
|
||||
Node: Directory Stack Builtins231767
|
||||
Node: Printing a Prompt234659
|
||||
Node: The Restricted Shell237411
|
||||
Node: Bash POSIX Mode239243
|
||||
Node: Job Control248173
|
||||
Node: Job Control Basics248633
|
||||
Node: Job Control Builtins253350
|
||||
Node: Job Control Variables257714
|
||||
Node: Command Line Editing258872
|
||||
Node: Introduction and Notation260439
|
||||
Node: Readline Interaction262061
|
||||
Node: Readline Bare Essentials263252
|
||||
Node: Readline Movement Commands265041
|
||||
Node: Readline Killing Commands266006
|
||||
Node: Readline Arguments267926
|
||||
Node: Searching268970
|
||||
Node: Readline Init File271156
|
||||
Node: Readline Init File Syntax272303
|
||||
Node: Conditional Init Constructs287407
|
||||
Node: Sample Init File289940
|
||||
Node: Bindable Readline Commands293057
|
||||
Node: Commands For Moving294264
|
||||
Node: Commands For History295408
|
||||
Node: Commands For Text298563
|
||||
Node: Commands For Killing301236
|
||||
Node: Numeric Arguments303687
|
||||
Node: Commands For Completion304826
|
||||
Node: Keyboard Macros309018
|
||||
Node: Miscellaneous Commands309589
|
||||
Node: Readline vi Mode315395
|
||||
Node: Programmable Completion316302
|
||||
Node: Programmable Completion Builtins323512
|
||||
Node: Using History Interactively332648
|
||||
Node: Bash History Facilities333332
|
||||
Node: Bash History Builtins336246
|
||||
Node: History Interaction340103
|
||||
Node: Event Designators342808
|
||||
Node: Word Designators343823
|
||||
Node: Modifiers345462
|
||||
Node: Installing Bash346866
|
||||
Node: Basic Installation348003
|
||||
Node: Compilers and Options350695
|
||||
Node: Compiling For Multiple Architectures351436
|
||||
Node: Installation Names353100
|
||||
Node: Specifying the System Type353918
|
||||
Node: Sharing Defaults354634
|
||||
Node: Operation Controls355307
|
||||
Node: Optional Features356265
|
||||
Node: Reporting Bugs365824
|
||||
Node: Major Differences From The Bourne Shell367025
|
||||
Node: GNU Free Documentation License383712
|
||||
Node: Indexes408908
|
||||
Node: Builtin Index409362
|
||||
Node: Reserved Word Index416189
|
||||
Node: Variable Index418637
|
||||
Node: Function Index431591
|
||||
Node: Concept Index438600
|
||||
Node: Top1344
|
||||
Node: Introduction3181
|
||||
Node: What is Bash?3409
|
||||
Node: What is a shell?4522
|
||||
Node: Definitions7062
|
||||
Node: Basic Shell Features9980
|
||||
Node: Shell Syntax11199
|
||||
Node: Shell Operation12229
|
||||
Node: Quoting13523
|
||||
Node: Escape Character14826
|
||||
Node: Single Quotes15311
|
||||
Node: Double Quotes15659
|
||||
Node: ANSI-C Quoting16784
|
||||
Node: Locale Translation18028
|
||||
Node: Comments18924
|
||||
Node: Shell Commands19542
|
||||
Node: Simple Commands20414
|
||||
Node: Pipelines21045
|
||||
Node: Lists23739
|
||||
Node: Compound Commands25468
|
||||
Node: Looping Constructs26272
|
||||
Node: Conditional Constructs28731
|
||||
Node: Command Grouping36844
|
||||
Node: Coprocesses38323
|
||||
Node: GNU Parallel39988
|
||||
Node: Shell Functions42456
|
||||
Node: Shell Parameters47400
|
||||
Node: Positional Parameters49816
|
||||
Node: Special Parameters50716
|
||||
Node: Shell Expansions53680
|
||||
Node: Brace Expansion55605
|
||||
Node: Tilde Expansion58360
|
||||
Node: Shell Parameter Expansion60711
|
||||
Node: Command Substitution69846
|
||||
Node: Arithmetic Expansion71179
|
||||
Node: Process Substitution72029
|
||||
Node: Word Splitting73079
|
||||
Node: Filename Expansion74702
|
||||
Node: Pattern Matching76841
|
||||
Node: Quote Removal80480
|
||||
Node: Redirections80775
|
||||
Node: Executing Commands89300
|
||||
Node: Simple Command Expansion89970
|
||||
Node: Command Search and Execution91900
|
||||
Node: Command Execution Environment94237
|
||||
Node: Environment97223
|
||||
Node: Exit Status98883
|
||||
Node: Signals100504
|
||||
Node: Shell Scripts102472
|
||||
Node: Shell Builtin Commands104990
|
||||
Node: Bourne Shell Builtins107018
|
||||
Node: Bash Builtins124694
|
||||
Node: Modifying Shell Behavior150908
|
||||
Node: The Set Builtin151253
|
||||
Node: The Shopt Builtin160787
|
||||
Node: Special Builtins172752
|
||||
Node: Shell Variables173731
|
||||
Node: Bourne Shell Variables174171
|
||||
Node: Bash Variables176198
|
||||
Node: Bash Features201123
|
||||
Node: Invoking Bash202006
|
||||
Node: Bash Startup Files207770
|
||||
Node: Interactive Shells212791
|
||||
Node: What is an Interactive Shell?213201
|
||||
Node: Is this Shell Interactive?213850
|
||||
Node: Interactive Shell Behavior214665
|
||||
Node: Bash Conditional Expressions217945
|
||||
Node: Shell Arithmetic221693
|
||||
Node: Aliases224452
|
||||
Node: Arrays227024
|
||||
Node: The Directory Stack231139
|
||||
Node: Directory Stack Builtins231853
|
||||
Node: Printing a Prompt234745
|
||||
Node: The Restricted Shell237497
|
||||
Node: Bash POSIX Mode239329
|
||||
Node: Job Control247990
|
||||
Node: Job Control Basics248450
|
||||
Node: Job Control Builtins253167
|
||||
Node: Job Control Variables257531
|
||||
Node: Command Line Editing258689
|
||||
Node: Introduction and Notation260256
|
||||
Node: Readline Interaction261878
|
||||
Node: Readline Bare Essentials263069
|
||||
Node: Readline Movement Commands264858
|
||||
Node: Readline Killing Commands265823
|
||||
Node: Readline Arguments267743
|
||||
Node: Searching268787
|
||||
Node: Readline Init File270973
|
||||
Node: Readline Init File Syntax272120
|
||||
Node: Conditional Init Constructs287462
|
||||
Node: Sample Init File289995
|
||||
Node: Bindable Readline Commands293112
|
||||
Node: Commands For Moving294319
|
||||
Node: Commands For History295463
|
||||
Node: Commands For Text298618
|
||||
Node: Commands For Killing301291
|
||||
Node: Numeric Arguments303742
|
||||
Node: Commands For Completion304881
|
||||
Node: Keyboard Macros309073
|
||||
Node: Miscellaneous Commands309644
|
||||
Node: Readline vi Mode315450
|
||||
Node: Programmable Completion316357
|
||||
Node: Programmable Completion Builtins323567
|
||||
Node: Using History Interactively332703
|
||||
Node: Bash History Facilities333387
|
||||
Node: Bash History Builtins336301
|
||||
Node: History Interaction340158
|
||||
Node: Event Designators342863
|
||||
Node: Word Designators344085
|
||||
Node: Modifiers345724
|
||||
Node: Installing Bash347128
|
||||
Node: Basic Installation348265
|
||||
Node: Compilers and Options350957
|
||||
Node: Compiling For Multiple Architectures351698
|
||||
Node: Installation Names353362
|
||||
Node: Specifying the System Type354180
|
||||
Node: Sharing Defaults354896
|
||||
Node: Operation Controls355569
|
||||
Node: Optional Features356527
|
||||
Node: Reporting Bugs366086
|
||||
Node: Major Differences From The Bourne Shell367287
|
||||
Node: GNU Free Documentation License383974
|
||||
Node: Indexes409170
|
||||
Node: Builtin Index409624
|
||||
Node: Reserved Word Index416451
|
||||
Node: Variable Index418899
|
||||
Node: Function Index431994
|
||||
Node: Concept Index439003
|
||||
|
||||
End Tag Table
|
||||
|
||||
+12
-12
@@ -1,4 +1,4 @@
|
||||
This is TeX, Version 3.141592 (Web2C 7.5.4) (format=tex 2008.12.11) 21 JUL 2010 08:54
|
||||
This is TeX, Version 3.141592 (Web2C 7.5.4) (format=tex 2008.12.11) 25 OCT 2010 12:00
|
||||
**/Users/chet/src/bash/src/doc/bashref.texi
|
||||
(/Users/chet/src/bash/src/doc/bashref.texi (./texinfo.tex
|
||||
Loading texinfo [version 2009-01-18.17]:
|
||||
@@ -260,7 +260,7 @@ rs@texttt ] [-p @textttsl prompt@texttt ] [-t @textttsl time-
|
||||
|
||||
[50] [51] [52] [53] [54] [55] [56] [57] [58] [59] [60] [61] Chapter 5 [62]
|
||||
[63] [64] [65] [66] [67] [68] [69] [70] [71] Chapter 6 [72]
|
||||
Overfull \hbox (51.96864pt too wide) in paragraph at lines 5483--5483
|
||||
Overfull \hbox (51.96864pt too wide) in paragraph at lines 5485--5485
|
||||
[]@texttt bash [long-opt] [-ir] [-abefhkmnptuvxdBCDHP] [-o @textttsl op-tion@t
|
||||
exttt ] [-O @textttsl shopt_option@texttt ] [@textttsl ar-
|
||||
|
||||
@@ -273,7 +273,7 @@ exttt ] [-O @textttsl shopt_option@texttt ] [@textttsl ar-
|
||||
.etc.
|
||||
|
||||
|
||||
Overfull \hbox (76.23077pt too wide) in paragraph at lines 5484--5484
|
||||
Overfull \hbox (76.23077pt too wide) in paragraph at lines 5486--5486
|
||||
[]@texttt bash [long-opt] [-abefhkmnptuvxdBCDHP] [-o @textttsl op-tion@texttt
|
||||
] [-O @textttsl shopt_option@texttt ] -c @textttsl string @texttt [@textttsl ar
|
||||
-
|
||||
@@ -287,7 +287,7 @@ Overfull \hbox (76.23077pt too wide) in paragraph at lines 5484--5484
|
||||
.etc.
|
||||
|
||||
|
||||
Overfull \hbox (34.72258pt too wide) in paragraph at lines 5485--5485
|
||||
Overfull \hbox (34.72258pt too wide) in paragraph at lines 5487--5487
|
||||
[]@texttt bash [long-opt] -s [-abefhkmnptuvxdBCDHP] [-o @textttsl op-tion@text
|
||||
tt ] [-O @textttsl shopt_option@texttt ] [@textttsl ar-
|
||||
|
||||
@@ -300,7 +300,7 @@ tt ] [-O @textttsl shopt_option@texttt ] [@textttsl ar-
|
||||
.etc.
|
||||
|
||||
[73] [74]
|
||||
Underfull \hbox (badness 2245) in paragraph at lines 5658--5660
|
||||
Underfull \hbox (badness 2245) in paragraph at lines 5660--5662
|
||||
[]@textrm When a lo-gin shell ex-its, Bash reads and ex-e-cutes com-mands from
|
||||
the file
|
||||
|
||||
@@ -313,7 +313,7 @@ the file
|
||||
.etc.
|
||||
|
||||
[75] [76] [77] [78] [79] [80] [81] [82] [83] [84] [85] [86] [87] [88]
|
||||
Underfull \hbox (badness 2521) in paragraph at lines 6834--6837
|
||||
Underfull \hbox (badness 2521) in paragraph at lines 6829--6832
|
||||
@textrm `@texttt --enable-strict-posix-default[]@textrm '[] to @texttt configur
|
||||
e[] @textrm when build-ing (see Sec-tion 10.8
|
||||
|
||||
@@ -341,7 +341,7 @@ m , @texttt vi-move[]@textrm , @texttt vi-command[]@textrm , and
|
||||
.etc.
|
||||
|
||||
[101] [102] [103] [104] [105]
|
||||
Overfull \hbox (26.43913pt too wide) in paragraph at lines 888--888
|
||||
Overfull \hbox (26.43913pt too wide) in paragraph at lines 894--894
|
||||
[]@texttt Meta-Control-h: backward-kill-word Text after the function name is i
|
||||
gnored[]
|
||||
|
||||
@@ -355,7 +355,7 @@ gnored[]
|
||||
|
||||
[106] [107] [108] [109] [110] [111] [112] [113] [114] [115] [116] [117]
|
||||
[118]
|
||||
Overfull \hbox (12.05716pt too wide) in paragraph at lines 1809--1809
|
||||
Overfull \hbox (12.05716pt too wide) in paragraph at lines 1815--1815
|
||||
[]@texttt complete [-abcdefgjksuv] [-o @textttsl comp-option@texttt ] [-DE] [-
|
||||
A @textttsl ac-tion@texttt ] [-
|
||||
|
||||
@@ -368,7 +368,7 @@ A @textttsl ac-tion@texttt ] [-
|
||||
.etc.
|
||||
|
||||
[119] [120]
|
||||
Underfull \hbox (badness 2753) in paragraph at lines 1919--1922
|
||||
Underfull \hbox (badness 2753) in paragraph at lines 1925--1928
|
||||
@texttt hostname[]@textrm Hostnames, as taken from the file spec-i-fied by
|
||||
|
||||
@hbox(7.60416+2.12917)x433.62, glue set 3.02202
|
||||
@@ -381,7 +381,7 @@ Underfull \hbox (badness 2753) in paragraph at lines 1919--1922
|
||||
|
||||
[121]) (/Users/chet/src/bash/src/lib/readline/doc/hsuser.texi Chapter 9
|
||||
[122] [123] [124] [125] [126]) Chapter 10 [127] [128] [129] [130] [131]
|
||||
Underfull \hbox (badness 2772) in paragraph at lines 7435--7439
|
||||
Underfull \hbox (badness 2772) in paragraph at lines 7430--7434
|
||||
[]@textrm Enable sup-port for large files (@texttt http://www.sas.com/standard
|
||||
s/large_
|
||||
|
||||
@@ -401,10 +401,10 @@ s/large_
|
||||
Here is how much of TeX's memory you used:
|
||||
2081 strings out of 97980
|
||||
28558 string characters out of 1221004
|
||||
65605 words of memory out of 1500000
|
||||
65620 words of memory out of 1500000
|
||||
2897 multiletter control sequences out of 10000+50000
|
||||
32127 words of font info for 112 fonts, out of 1200000 for 2000
|
||||
51 hyphenation exceptions out of 8191
|
||||
16i,6n,14p,315b,702s stack positions out of 5000i,500n,6000p,200000b,5000s
|
||||
|
||||
Output written on bashref.dvi (166 pages, 678492 bytes).
|
||||
Output written on bashref.dvi (166 pages, 679016 bytes).
|
||||
|
||||
Binary file not shown.
+1198
-1195
File diff suppressed because it is too large
Load Diff
+6
-13
@@ -1717,7 +1717,7 @@ Bash uses the value of the variable formed from the rest of
|
||||
expanded and that value is used in the rest of the substitution, rather
|
||||
than the value of @var{parameter} itself.
|
||||
This is known as @code{indirect expansion}.
|
||||
The exceptions to this are the expansions of $@{!@var{prefix}@*}
|
||||
The exceptions to this are the expansions of $@{!@var{prefix}@*@}
|
||||
and $@{!@var{name}[@@]@}
|
||||
described below.
|
||||
The exclamation point must immediately follow the left brace in order to
|
||||
@@ -6694,14 +6694,6 @@ the @sc{posix} standard, and include things like passing incorrect options,
|
||||
redirection errors, variable assignment errors for assignments preceding
|
||||
the command name, and so on.
|
||||
|
||||
@item
|
||||
If @env{CDPATH} is set, the @code{cd} builtin will not implicitly
|
||||
append the current directory to it. This means that @code{cd} will
|
||||
fail if no valid directory name can be constructed from
|
||||
any of the entries in @env{$CDPATH}, even if the a directory with
|
||||
the same name as the name given as an argument to @code{cd} exists
|
||||
in the current directory.
|
||||
|
||||
@item
|
||||
A non-interactive shell exits with an error status if a variable
|
||||
assignment error occurs when no command name follows the assignment
|
||||
@@ -6709,6 +6701,11 @@ statements.
|
||||
A variable assignment error occurs, for example, when trying to assign
|
||||
a value to a readonly variable.
|
||||
|
||||
@item
|
||||
A non-interactive shell exists with an error status if a variable
|
||||
assignment error occurs in an assignment statement preceding a special
|
||||
builtin, but not with any other simple command.
|
||||
|
||||
@item
|
||||
A non-interactive shell exits with an error status if the iteration
|
||||
variable in a @code{for} statement or the selection variable in a
|
||||
@@ -6774,10 +6771,6 @@ constructed from @code{$PWD} and the directory name supplied as an argument
|
||||
does not refer to an existing directory, @code{cd} will fail instead of
|
||||
falling back to @var{physical} mode.
|
||||
|
||||
@item
|
||||
When the @code{pwd} builtin is supplied the @option{-P} option, it resets
|
||||
@code{$PWD} to a pathname containing no symlinks.
|
||||
|
||||
@item
|
||||
The @code{pwd} builtin verifies that the value it prints is the same as the
|
||||
current directory, even if it is not asked to check the file system with the
|
||||
|
||||
+2
-1
@@ -128,10 +128,11 @@
|
||||
\entry{mark-modified-lines}{101}{\code {mark-modified-lines}}
|
||||
\entry{mark-symlinked-directories}{101}{\code {mark-symlinked-directories}}
|
||||
\entry{match-hidden-files}{101}{\code {match-hidden-files}}
|
||||
\entry{menu-complete-display-prefix}{102}{\code {menu-complete-display-prefix}}
|
||||
\entry{output-meta}{102}{\code {output-meta}}
|
||||
\entry{page-completions}{102}{\code {page-completions}}
|
||||
\entry{revert-all-at-newline}{102}{\code {revert-all-at-newline}}
|
||||
\entry{show-all-if-ambiguous}{102}{\code {show-all-if-ambiguous}}
|
||||
\entry{show-all-if-unmodified}{102}{\code {show-all-if-unmodified}}
|
||||
\entry{skip-completed-text}{102}{\code {skip-completed-text}}
|
||||
\entry{visible-stats}{102}{\code {visible-stats}}
|
||||
\entry{visible-stats}{103}{\code {visible-stats}}
|
||||
|
||||
+2
-1
@@ -117,6 +117,7 @@
|
||||
\entry {\code {mark-modified-lines}}{101}
|
||||
\entry {\code {mark-symlinked-directories}}{101}
|
||||
\entry {\code {match-hidden-files}}{101}
|
||||
\entry {\code {menu-complete-display-prefix}}{102}
|
||||
\entry {\code {meta-flag}}{101}
|
||||
\initial {O}
|
||||
\entry {\code {OLDPWD}}{70}
|
||||
@@ -161,4 +162,4 @@
|
||||
\initial {U}
|
||||
\entry {\code {UID}}{72}
|
||||
\initial {V}
|
||||
\entry {\code {visible-stats}}{102}
|
||||
\entry {\code {visible-stats}}{103}
|
||||
|
||||
+6
-6
@@ -601,7 +601,7 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
|
||||
|
||||
When the end of options is encountered, ggeettooppttss exits with a
|
||||
return value greater than zero. OOPPTTIINNDD is set to the index of
|
||||
the first non-option argument, and nnaammee is set to ?.
|
||||
the first non-option argument, and _n_a_m_e is set to ?.
|
||||
|
||||
ggeettooppttss normally parses the positional parameters, but if more
|
||||
arguments are given in _a_r_g_s, ggeettooppttss parses those instead.
|
||||
@@ -983,8 +983,8 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
|
||||
status is false. Any command associated with the RREETTUURRNN trap is
|
||||
executed before execution resumes after the function or script.
|
||||
|
||||
sseett [----aabbeeffhhkkmmnnppttuuvvxxBBCCEEHHPPTT] [--oo _o_p_t_i_o_n] [_a_r_g ...]
|
||||
sseett [++aabbeeffhhkkmmnnppttuuvvxxBBCCEEHHPPTT] [++oo _o_p_t_i_o_n] [_a_r_g ...]
|
||||
sseett [----aabbeeffhhkkmmnnppttuuvvxxBBCCEEHHPPTT] [--oo _o_p_t_i_o_n_-_n_a_m_e] [_a_r_g ...]
|
||||
sseett [++aabbeeffhhkkmmnnppttuuvvxxBBCCEEHHPPTT] [++oo _o_p_t_i_o_n_-_n_a_m_e] [_a_r_g ...]
|
||||
Without options, the name and value of each shell variable are
|
||||
displayed in a format that can be reused as input for setting or
|
||||
resetting the currently-set variables. Read-only variables can-
|
||||
@@ -1228,15 +1228,15 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
|
||||
ccoommppaatt3311
|
||||
If set, bbaasshh changes its behavior to that of version 3.1
|
||||
with respect to quoted arguments to the conditional com-
|
||||
mand's =~ operator.
|
||||
mand's ==~~ operator.
|
||||
ccoommppaatt3322
|
||||
If set, bbaasshh changes its behavior to that of version 3.2
|
||||
with respect to locale-specific string comparison when
|
||||
using the conditional command's < and > operators.
|
||||
using the conditional command's << and >> operators.
|
||||
ccoommppaatt4400
|
||||
If set, bbaasshh changes its behavior to that of version 4.0
|
||||
with respect to locale-specific string comparison when
|
||||
using the conditional command's < and > operators and
|
||||
using the conditional command's << and >> operators and
|
||||
the effect of interrupting a command list.
|
||||
ccoommppaatt4411
|
||||
@item compat41 If set, bbaasshh, when in posix mode, treats
|
||||
|
||||
+31
-30
@@ -1,6 +1,6 @@
|
||||
%!PS-Adobe-3.0
|
||||
%%Creator: groff version 1.19.2
|
||||
%%CreationDate: Wed Jul 21 08:54:49 2010
|
||||
%%CreationDate: Mon Oct 25 10:55:37 2010
|
||||
%%DocumentNeededResources: font Times-Roman
|
||||
%%+ font Times-Bold
|
||||
%%+ font Times-Italic
|
||||
@@ -1192,7 +1192,7 @@ Q 2.043(When the end of options is encountered,)144 710.4 R F1(getopts)
|
||||
4.543 E F0 -.15(ex)4.543 G 2.043(its with a return v).15 F 2.044
|
||||
(alue greater than zero.)-.25 F F4(OPTIND)144 722.4 Q F0
|
||||
(is set to the inde)2.25 E 2.5(xo)-.15 G 2.5(ft)-2.5 G
|
||||
(he \214rst non-option ar)-2.5 E(gument, and)-.18 E F1(name)2.5 E F0
|
||||
(he \214rst non-option ar)-2.5 E(gument, and)-.18 E F2(name)2.5 E F0
|
||||
(is set to ?.)2.5 E(GNU Bash-4.0)72 768 Q(2004 Apr 20)148.735 E(8)
|
||||
203.725 E 0 Cg EP
|
||||
%%Page: 9 9
|
||||
@@ -1781,12 +1781,13 @@ E F0 .246(or the e)2.985 F .246(xit status of the last command e)-.15 F
|
||||
4.805 E F0 2.306(trap is e)4.806 F -.15(xe)-.15 G 2.306(cuted before e)
|
||||
.15 F -.15(xe)-.15 G(cution).15 E(resumes after the function or script.)
|
||||
144 554.4 Q F1(set)108 571.2 Q F0([)2.5 E F1
|
||||
(\255\255abefhkmnptuvxBCEHPT)A F0 2.5(][)C F1<ad6f>-2.5 E F2(option)2.5
|
||||
E F0 2.5(][)C F2(ar)-2.5 E(g)-.37 E F0(...])2.5 E F1(set)108 583.2 Q F0
|
||||
([)2.5 E F1(+abefhkmnptuvxBCEHPT)A F0 2.5(][)C F1(+o)-2.5 E F2(option)
|
||||
2.5 E F0 2.5(][)C F2(ar)-2.5 E(g)-.37 E F0(...])2.5 E -.4(Wi)144 595.2 S
|
||||
.836(thout options, the name and v).4 F .835(alue of each shell v)-.25 F
|
||||
.835(ariable are displayed in a format that can be)-.25 F .784
|
||||
(\255\255abefhkmnptuvxBCEHPT)A F0 2.5(][)C F1<ad6f>-2.5 E F2
|
||||
(option\255name)2.5 E F0 2.5(][)C F2(ar)-2.5 E(g)-.37 E F0(...])2.5 E F1
|
||||
(set)108 583.2 Q F0([)2.5 E F1(+abefhkmnptuvxBCEHPT)A F0 2.5(][)C F1(+o)
|
||||
-2.5 E F2(option\255name)2.5 E F0 2.5(][)C F2(ar)-2.5 E(g)-.37 E F0
|
||||
(...])2.5 E -.4(Wi)144 595.2 S .836(thout options, the name and v).4 F
|
||||
.835(alue of each shell v)-.25 F .835
|
||||
(ariable are displayed in a format that can be)-.25 F .784
|
||||
(reused as input for setting or resetting the currently-set v)144 607.2
|
||||
R 3.284(ariables. Read-only)-.25 F -.25(va)3.284 G .784
|
||||
(riables cannot be).25 F 2.947(reset. In)144 619.2 R F2 .447(posix mode)
|
||||
@@ -2130,9 +2131,9 @@ F0(and)2.25 E F3(COLUMNS)2.5 E/F4 9/Times-Roman@0 SF(.)A F1(cmdhist)144
|
||||
(ws easy re-editing of multi-line commands.)-.25 E F1(compat31)144 702 Q
|
||||
F0 .42(If set,)184 714 R F1(bash)2.92 E F0 .42(changes its beha)2.92 F
|
||||
.419(vior to that of v)-.2 F .419(ersion 3.1 with respect to quoted ar)
|
||||
-.15 F(guments)-.18 E(to the conditional command')184 726 Q 2.5(s=)-.55
|
||||
G 2.5(~o)-2.5 G(perator)-2.5 E(.)-.55 E(GNU Bash-4.0)72 768 Q
|
||||
(2004 Apr 20)148.735 E(16)198.725 E 0 Cg EP
|
||||
-.15 F(guments)-.18 E(to the conditional command')184 726 Q(s)-.55 E F1
|
||||
(=~)2.5 E F0(operator)2.5 E(.)-.55 E(GNU Bash-4.0)72 768 Q(2004 Apr 20)
|
||||
148.735 E(16)198.725 E 0 Cg EP
|
||||
%%Page: 17 17
|
||||
%%BeginPageSetup
|
||||
BP
|
||||
@@ -2142,25 +2143,25 @@ BP
|
||||
/Times-Bold@0 SF(compat32)144 84 Q F0 1.409(If set,)184 96 R F1(bash)
|
||||
3.909 E F0 1.409(changes its beha)3.909 F 1.409(vior to that of v)-.2 F
|
||||
1.41(ersion 3.2 with respect to locale-speci\214c)-.15 F
|
||||
(string comparison when using the conditional command')184 108 Q 2.5
|
||||
(s<a)-.55 G(nd > operators.)-2.5 E F1(compat40)144 120 Q F0 1.41
|
||||
(If set,)184 132 R F1(bash)3.91 E F0 1.41(changes its beha)3.91 F 1.409
|
||||
(vior to that of v)-.2 F 1.409
|
||||
(ersion 4.0 with respect to locale-speci\214c)-.15 F 1.692
|
||||
(string comparison when using the conditional command')184 144 R 4.193
|
||||
(s<a)-.55 G 1.693(nd > operators and the)-4.193 F(ef)184 156 Q
|
||||
(fect of interrupting a command list.)-.25 E F1(compat41)144 168 Q F0
|
||||
1.232(@item compat41 If set,)184 180 R F1(bash)3.732 E F0 3.732(,w)C
|
||||
1.232(hen in posix mode, treats a single quote in a double-)-3.732 F
|
||||
1.213(quoted parameter e)184 192 R 1.213
|
||||
(xpansion as a special character)-.15 F 6.213(.T)-.55 G 1.214
|
||||
(he single quotes must match \(an)-6.213 F -2.15 -.25(ev e)184 204 T
|
||||
2.949(nn).25 G .448(umber\) and the characters between the single quote\
|
||||
s are considered quoted.)-2.949 F(This)5.448 E .062(is the beha)184 216
|
||||
R .062(vior of posix mode through v)-.2 F .062(ersion 4.1.)-.15 F .062
|
||||
(The def)5.062 F .062(ault bash beha)-.1 F .063(vior remains as)-.2 F
|
||||
(in pre)184 228 Q(vious v)-.25 E(ersions.)-.15 E F1(dirspell)144 240 Q
|
||||
F0 .859(If set,)7.77 F F1(bash)3.359 E F0 .858
|
||||
(string comparison when using the conditional command')184 108 Q(s)-.55
|
||||
E F1(<)2.5 E F0(and)2.5 E F1(>)2.5 E F0(operators.)2.5 E F1(compat40)144
|
||||
120 Q F0 1.41(If set,)184 132 R F1(bash)3.91 E F0 1.41(changes its beha)
|
||||
3.91 F 1.409(vior to that of v)-.2 F 1.409
|
||||
(ersion 4.0 with respect to locale-speci\214c)-.15 F 1.682
|
||||
(string comparison when using the conditional command')184 144 R(s)-.55
|
||||
E F1(<)4.183 E F0(and)4.183 E F1(>)4.183 E F0 1.683(operators and the)
|
||||
4.183 F(ef)184 156 Q(fect of interrupting a command list.)-.25 E F1
|
||||
(compat41)144 168 Q F0 1.232(@item compat41 If set,)184 180 R F1(bash)
|
||||
3.732 E F0 3.732(,w)C 1.232
|
||||
(hen in posix mode, treats a single quote in a double-)-3.732 F 1.213
|
||||
(quoted parameter e)184 192 R 1.213(xpansion as a special character)-.15
|
||||
F 6.213(.T)-.55 G 1.214(he single quotes must match \(an)-6.213 F -2.15
|
||||
-.25(ev e)184 204 T 2.949(nn).25 G .448(umber\) and the characters betw\
|
||||
een the single quotes are considered quoted.)-2.949 F(This)5.448 E .062
|
||||
(is the beha)184 216 R .062(vior of posix mode through v)-.2 F .062
|
||||
(ersion 4.1.)-.15 F .062(The def)5.062 F .062(ault bash beha)-.1 F .063
|
||||
(vior remains as)-.2 F(in pre)184 228 Q(vious v)-.25 E(ersions.)-.15 E
|
||||
F1(dirspell)144 240 Q F0 .859(If set,)7.77 F F1(bash)3.359 E F0 .858
|
||||
(attempts spelling correction on directory names during w)3.359 F .858
|
||||
(ord completion if)-.1 F
|
||||
(the directory name initially supplied does not e)184 252 Q(xist.)-.15 E
|
||||
|
||||
+2
-2
@@ -21,7 +21,7 @@ RREESSTTRRIICCTTEEDD SSHHEELLLL
|
||||
+o specifying a file name containing a // as an argument to the ..
|
||||
builtin command
|
||||
|
||||
+o Specifying a filename containing a slash as an argument to the
|
||||
+o specifying a filename containing a slash as an argument to the
|
||||
--pp option to the hhaasshh builtin command
|
||||
|
||||
+o importing function definitions from the shell environment at
|
||||
@@ -39,7 +39,7 @@ RREESSTTRRIICCTTEEDD SSHHEELLLL
|
||||
+o adding or deleting builtin commands with the --ff and --dd options
|
||||
to the eennaabbllee builtin command
|
||||
|
||||
+o Using the eennaabbllee builtin command to enable disabled shell
|
||||
+o using the eennaabbllee builtin command to enable disabled shell
|
||||
builtins
|
||||
|
||||
+o specifying the --pp option to the ccoommmmaanndd builtin command
|
||||
|
||||
+6
-6
@@ -1,6 +1,6 @@
|
||||
%!PS-Adobe-3.0
|
||||
%%Creator: groff version 1.19.2
|
||||
%%CreationDate: Wed Jul 21 08:54:50 2010
|
||||
%%CreationDate: Mon Oct 25 10:55:38 2010
|
||||
%%DocumentNeededResources: font Times-Roman
|
||||
%%+ font Times-Bold
|
||||
%%DocumentSuppliedResources: procset grops 1.19 2
|
||||
@@ -247,10 +247,10 @@ G(TH)-.189 E F4(,)A F3(ENV)2.25 E F4(,)A F0(or)2.25 E F3 -.27(BA)2.5 G
|
||||
(pecifying command names containing)-32.5 E F2(/)2.5 E F0 32.5<8373>108
|
||||
216 S(pecifying a \214le name containing a)-32.5 E F2(/)2.5 E F0
|
||||
(as an ar)2.5 E(gument to the)-.18 E F2(.)2.5 E F0 -.2(bu)5 G
|
||||
(iltin command).2 E 32.5<8353>108 232.8 S .351
|
||||
(pecifying a \214lename containing a slash as an ar)-32.5 F .351
|
||||
(gument to the)-.18 F F2<ad70>2.851 E F0 .351(option to the)2.851 F F2
|
||||
(hash)2.851 E F0 -.2(bu)2.851 G .351(iltin com-).2 F(mand)144 244.8 Q
|
||||
(iltin command).2 E 32.5<8373>108 232.8 S .45
|
||||
(pecifying a \214lename containing a slash as an ar)-32.5 F .449
|
||||
(gument to the)-.18 F F2<ad70>2.949 E F0 .449(option to the)2.949 F F2
|
||||
(hash)2.949 E F0 -.2(bu)2.949 G .449(iltin com-).2 F(mand)144 244.8 Q
|
||||
32.5<8369>108 261.6 S(mporting function de\214nitions from the shell en)
|
||||
-32.5 E(vironment at startup)-.4 E 32.5<8370>108 278.4 S(arsing the v)
|
||||
-32.5 E(alue of)-.25 E F3(SHELLOPTS)2.5 E F0(from the shell en)2.25 E
|
||||
@@ -260,7 +260,7 @@ ng the >, >|, <>, >&, &>, and >> redirection operators)-32.5 E 32.5
|
||||
(iltin command to replace the shell with another command).2 E 32.5<8361>
|
||||
108 328.8 S(dding or deleting b)-32.5 E(uiltin commands with the)-.2 E
|
||||
F2<ad66>2.5 E F0(and)2.5 E F2<ad64>2.5 E F0(options to the)2.5 E F2
|
||||
(enable)2.5 E F0 -.2(bu)2.5 G(iltin command).2 E 32.5<8355>108 345.6 S
|
||||
(enable)2.5 E F0 -.2(bu)2.5 G(iltin command).2 E 32.5<8375>108 345.6 S
|
||||
(sing the)-32.5 E F2(enable)2.5 E F0 -.2(bu)2.5 G
|
||||
(iltin command to enable disabled shell b).2 E(uiltins)-.2 E 32.5<8373>
|
||||
108 362.4 S(pecifying the)-32.5 E F2<ad70>2.5 E F0(option to the)2.5 E
|
||||
|
||||
+3
-3
@@ -2,9 +2,9 @@
|
||||
Copyright (C) 1988-2010 Free Software Foundation, Inc.
|
||||
@end ignore
|
||||
|
||||
@set LASTCHANGE Mon Sep 6 22:08:10 EDT 2010
|
||||
@set LASTCHANGE Wed Oct 20 21:37:22 EDT 2010
|
||||
|
||||
@set EDITION 4.2
|
||||
@set VERSION 4.2
|
||||
@set UPDATED 6 September 2010
|
||||
@set UPDATED-MONTH September 2010
|
||||
@set UPDATED 20 October 2010
|
||||
@set UPDATED-MONTH October 2010
|
||||
|
||||
@@ -103,7 +103,6 @@
|
||||
#ifndef TOCTRL
|
||||
/* letter to control char -- ASCII. The TOUPPER is in there so \ce and
|
||||
\cE will map to the same character in $'...' expansions. */
|
||||
/* XXX - should this be TOUPPER(x) ^ x040 ? */
|
||||
# define TOCTRL(x) (TOUPPER(x) & 037)
|
||||
#endif
|
||||
#ifndef UNCTRL
|
||||
|
||||
@@ -2450,7 +2450,10 @@ rl_old_menu_complete (count, invoking_key)
|
||||
|
||||
match_list_index += count;
|
||||
if (match_list_index < 0)
|
||||
match_list_index += match_list_size;
|
||||
{
|
||||
while (match_list_index < 0)
|
||||
match_list_index += match_list_size;
|
||||
}
|
||||
else
|
||||
match_list_index %= match_list_size;
|
||||
|
||||
@@ -2615,7 +2618,10 @@ rl_menu_complete (count, ignore)
|
||||
|
||||
match_list_index += count;
|
||||
if (match_list_index < 0)
|
||||
match_list_index += match_list_size;
|
||||
{
|
||||
while (match_list_index < 0)
|
||||
match_list_index += match_list_size;
|
||||
}
|
||||
else
|
||||
match_list_index %= match_list_size;
|
||||
|
||||
|
||||
@@ -197,7 +197,7 @@ int _rl_skip_completed_text = 0;
|
||||
|
||||
/* If non-zero, menu completion displays the common prefix first in the
|
||||
cycle of possible completions instead of the last. */
|
||||
int _rl_menu_complete_prefix_first = 1;
|
||||
int _rl_menu_complete_prefix_first = 0;
|
||||
|
||||
/* If non-zero, then this is the address of a function to call when
|
||||
completing on a directory name. The function is called with
|
||||
@@ -2450,7 +2450,10 @@ rl_old_menu_complete (count, invoking_key)
|
||||
|
||||
match_list_index += count;
|
||||
if (match_list_index < 0)
|
||||
match_list_index += match_list_size;
|
||||
{
|
||||
while (match_list_index < 0)
|
||||
match_list_index += match_list_size;
|
||||
}
|
||||
else
|
||||
match_list_index %= match_list_size;
|
||||
|
||||
|
||||
@@ -1235,7 +1235,7 @@ Kill from point to the end of the current word, or if between
|
||||
words, to the end of the next word.
|
||||
Word boundaries are the same as @code{shell-forward-word}.
|
||||
|
||||
@item backward-kill-word ()
|
||||
@item shell-backward-kill-word ()
|
||||
Kill the word behind point.
|
||||
Word boundaries are the same as @code{shell-backward-word}.
|
||||
@end ifset
|
||||
|
||||
@@ -345,6 +345,7 @@ extern void _rl_set_cursor PARAMS((int, int));
|
||||
/* text.c */
|
||||
extern void _rl_fix_point PARAMS((int));
|
||||
extern int _rl_replace_text PARAMS((const char *, int, int));
|
||||
extern int _rl_forward_char_internal PARAMS((int));
|
||||
extern int _rl_insert_char PARAMS((int, int));
|
||||
extern int _rl_overwrite_char PARAMS((int, int));
|
||||
extern int _rl_overwrite_rubout PARAMS((int, int));
|
||||
|
||||
@@ -418,6 +418,7 @@ extern int _rl_completion_case_map;
|
||||
extern int _rl_match_hidden_files;
|
||||
extern int _rl_page_completions;
|
||||
extern int _rl_skip_completed_text;
|
||||
extern int _rl_menu_complete_prefix_first;
|
||||
|
||||
/* display.c */
|
||||
extern int _rl_vis_botlin;
|
||||
|
||||
+34
-14
@@ -265,11 +265,13 @@ rl_forward_byte (count, key)
|
||||
|
||||
if (count > 0)
|
||||
{
|
||||
int end = rl_point + count;
|
||||
int end, lend;
|
||||
|
||||
end = rl_point + count;
|
||||
#if defined (VI_MODE)
|
||||
int lend = rl_end > 0 ? rl_end - (VI_COMMAND_MODE()) : rl_end;
|
||||
lend = rl_end > 0 ? rl_end - (VI_COMMAND_MODE()) : rl_end;
|
||||
#else
|
||||
int lend = rl_end;
|
||||
lend = rl_end;
|
||||
#endif
|
||||
|
||||
if (end > lend)
|
||||
@@ -287,6 +289,31 @@ rl_forward_byte (count, key)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
_rl_forward_char_internal (count)
|
||||
int count;
|
||||
{
|
||||
int point;
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
point = _rl_find_next_mbchar (rl_line_buffer, rl_point, count, MB_FIND_NONZERO);
|
||||
|
||||
#if defined (VI_MODE)
|
||||
if (point >= rl_end && VI_COMMAND_MODE())
|
||||
point = _rl_find_prev_mbchar (rl_line_buffer, rl_end, MB_FIND_NONZERO);
|
||||
#endif
|
||||
|
||||
if (rl_end < 0)
|
||||
rl_end = 0;
|
||||
#else
|
||||
point = rl_point + count;
|
||||
if (point > rl_end)
|
||||
point = rl_end;
|
||||
#endif
|
||||
|
||||
return (point);
|
||||
}
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
/* Move forward COUNT characters. */
|
||||
int
|
||||
@@ -309,20 +336,12 @@ rl_forward_char (count, key)
|
||||
return 0;
|
||||
}
|
||||
|
||||
point = _rl_find_next_mbchar (rl_line_buffer, rl_point, count, MB_FIND_NONZERO);
|
||||
|
||||
#if defined (VI_MODE)
|
||||
if (point >= rl_end && VI_COMMAND_MODE())
|
||||
point = _rl_find_prev_mbchar (rl_line_buffer, rl_end, MB_FIND_NONZERO);
|
||||
#endif
|
||||
point = _rl_forward_char_internal (count);
|
||||
|
||||
if (rl_point == point)
|
||||
rl_ding ();
|
||||
|
||||
rl_point = point;
|
||||
|
||||
if (rl_end < 0)
|
||||
rl_end = 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -805,8 +824,9 @@ _rl_insert_char (count, c)
|
||||
/* We are inserting a single character.
|
||||
If there is pending input, then make a string of all of the
|
||||
pending characters that are bound to rl_insert, and insert
|
||||
them all. */
|
||||
if (_rl_any_typein ())
|
||||
them all. Don't do this if we're current reading input from
|
||||
a macro. */
|
||||
if ((RL_ISSTATE (RL_STATE_MACROINPUT) == 0) && _rl_any_typein ())
|
||||
_rl_insert_typein (c);
|
||||
else
|
||||
{
|
||||
|
||||
+37
-18
@@ -150,7 +150,7 @@ rl_delete_text (from, to)
|
||||
if (_rl_doing_an_undo == 0)
|
||||
rl_add_undo (UNDO_DELETE, from, to, text);
|
||||
else
|
||||
free (text);
|
||||
xfree (text);
|
||||
|
||||
rl_end -= diff;
|
||||
rl_line_buffer[rl_end] = '\0';
|
||||
@@ -265,11 +265,13 @@ rl_forward_byte (count, key)
|
||||
|
||||
if (count > 0)
|
||||
{
|
||||
int end = rl_point + count;
|
||||
int end, lend;
|
||||
|
||||
end = rl_point + count;
|
||||
#if defined (VI_MODE)
|
||||
int lend = rl_end > 0 ? rl_end - (VI_COMMAND_MODE()) : rl_end;
|
||||
lend = rl_end > 0 ? rl_end - (VI_COMMAND_MODE()) : rl_end;
|
||||
#else
|
||||
int lend = rl_end;
|
||||
lend = rl_end;
|
||||
#endif
|
||||
|
||||
if (end > lend)
|
||||
@@ -287,6 +289,31 @@ rl_forward_byte (count, key)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
_rl_forward_char_internal (count)
|
||||
int count;
|
||||
{
|
||||
int point;
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
point = _rl_find_next_mbchar (rl_line_buffer, rl_point, count, MB_FIND_NONZERO);
|
||||
|
||||
#if defined (VI_MODE)
|
||||
if (point >= rl_end && VI_COMMAND_MODE())
|
||||
point = _rl_find_prev_mbchar (rl_line_buffer, rl_end, MB_FIND_NONZERO);
|
||||
#endif
|
||||
|
||||
if (rl_end < 0)
|
||||
rl_end = 0;
|
||||
#else
|
||||
point = rl_point + count;
|
||||
if (point > rl_end)
|
||||
point = rl_end;
|
||||
#endif
|
||||
|
||||
return (point);
|
||||
}
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
/* Move forward COUNT characters. */
|
||||
int
|
||||
@@ -309,20 +336,12 @@ rl_forward_char (count, key)
|
||||
return 0;
|
||||
}
|
||||
|
||||
point = _rl_find_next_mbchar (rl_line_buffer, rl_point, count, MB_FIND_NONZERO);
|
||||
|
||||
#if defined (VI_MODE)
|
||||
if (point >= rl_end && VI_COMMAND_MODE())
|
||||
point = _rl_find_prev_mbchar (rl_line_buffer, rl_end, MB_FIND_NONZERO);
|
||||
#endif
|
||||
point = _rl_forward_char_internal (count);
|
||||
|
||||
if (rl_point == point)
|
||||
rl_ding ();
|
||||
|
||||
rl_point = point;
|
||||
|
||||
if (rl_end < 0)
|
||||
rl_end = 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -752,7 +771,7 @@ _rl_insert_char (count, c)
|
||||
|
||||
string[i] = '\0';
|
||||
rl_insert_text (string);
|
||||
free (string);
|
||||
xfree (string);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -779,7 +798,7 @@ _rl_insert_char (count, c)
|
||||
count -= decreaser;
|
||||
}
|
||||
|
||||
free (string);
|
||||
xfree (string);
|
||||
incoming_length = 0;
|
||||
stored_count = 0;
|
||||
#else /* !HANDLE_MULTIBYTE */
|
||||
@@ -1407,8 +1426,8 @@ rl_transpose_words (count, key)
|
||||
|
||||
/* I think that does it. */
|
||||
rl_end_undo_group ();
|
||||
free (word1);
|
||||
free (word2);
|
||||
xfree (word1);
|
||||
xfree (word2);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1467,7 +1486,7 @@ rl_transpose_chars (count, key)
|
||||
rl_end_undo_group ();
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
free (dummy);
|
||||
xfree (dummy);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
+46
-42
@@ -630,12 +630,16 @@ _rl_vi_append_forward (key)
|
||||
if (MB_CUR_MAX == 1 || rl_byte_oriented)
|
||||
rl_point++;
|
||||
else
|
||||
{
|
||||
point = rl_point;
|
||||
rl_forward_char (1, key);
|
||||
if (point == rl_point)
|
||||
rl_point = rl_end;
|
||||
}
|
||||
{
|
||||
point = rl_point;
|
||||
#if 0
|
||||
rl_forward_char (1, key);
|
||||
#else
|
||||
rl_point = _rl_forward_char_internal (1);
|
||||
#endif
|
||||
if (point == rl_point)
|
||||
rl_point = rl_end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -733,7 +737,7 @@ _rl_vi_done_inserting ()
|
||||
_rl_vi_last_key_before_insert == 'a' ||
|
||||
_rl_vi_last_key_before_insert == 'I' ||
|
||||
_rl_vi_last_key_before_insert == 'A'))
|
||||
_rl_vi_save_insert (rl_undo_list);
|
||||
_rl_vi_save_insert (rl_undo_list);
|
||||
/* XXX - Other keys probably need to be checked. */
|
||||
else if (_rl_vi_last_key_before_insert == 'C')
|
||||
rl_end_undo_group ();
|
||||
@@ -793,7 +797,7 @@ _rl_vi_change_mbchar_case (count)
|
||||
if (MB_INVALIDCH (m))
|
||||
wc = (wchar_t)rl_line_buffer[rl_point];
|
||||
else if (MB_NULLWCH (m))
|
||||
wc = L'\0';
|
||||
wc = L'\0';
|
||||
if (iswupper (wc))
|
||||
wc = towlower (wc);
|
||||
else if (iswlower (wc))
|
||||
@@ -821,7 +825,7 @@ _rl_vi_change_mbchar_case (count)
|
||||
rl_vi_check ();
|
||||
}
|
||||
else
|
||||
rl_forward_char (1, 0);
|
||||
rl_forward_char (1, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -868,7 +872,7 @@ rl_vi_change_case (count, ignore)
|
||||
_rl_insert_char (1, c);
|
||||
rl_end_undo_group ();
|
||||
rl_vi_check ();
|
||||
}
|
||||
}
|
||||
else
|
||||
rl_forward_char (1, c);
|
||||
}
|
||||
@@ -906,7 +910,7 @@ rl_vi_check ()
|
||||
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||
rl_point = _rl_find_prev_mbchar (rl_line_buffer, rl_point, MB_FIND_NONZERO);
|
||||
else
|
||||
rl_point--;
|
||||
rl_point--;
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
@@ -1059,7 +1063,7 @@ rl_domove_motion_callback (m)
|
||||
/* Posix.2 says that if cw or cW moves the cursor towards the end of
|
||||
the line, the character under the cursor should be deleted. */
|
||||
if (rl_point == rl_mark)
|
||||
rl_point++;
|
||||
rl_point++;
|
||||
else
|
||||
{
|
||||
/* Move past the end of the word so that the kill doesn't
|
||||
@@ -1099,7 +1103,7 @@ rl_domove_read_callback (m)
|
||||
/* If we just read a vi-mode motion command numeric argument, turn off
|
||||
the `reading numeric arg' state */
|
||||
if (RL_ISSTATE (RL_STATE_CALLBACK) && RL_VIMOVENUMARG())
|
||||
RL_UNSETSTATE (RL_STATE_NUMERICARG);
|
||||
RL_UNSETSTATE (RL_STATE_NUMERICARG);
|
||||
#endif
|
||||
/* Should do everything, including turning off RL_STATE_VIMOTION */
|
||||
return (rl_domove_motion_callback (m));
|
||||
@@ -1137,10 +1141,10 @@ rl_domove_read_callback (m)
|
||||
rl_numeric_arg *= save;
|
||||
c = rl_vi_domove_getchar (m);
|
||||
if (c < 0)
|
||||
{
|
||||
m->motion = 0;
|
||||
return -1;
|
||||
}
|
||||
{
|
||||
m->motion = 0;
|
||||
return -1;
|
||||
}
|
||||
m->motion = c;
|
||||
return (rl_domove_motion_callback (m));
|
||||
}
|
||||
@@ -1288,7 +1292,7 @@ vi_change_dispatch (m)
|
||||
rl_kill_text (rl_point, rl_mark);
|
||||
/* `C' does not save the text inserted for undoing or redoing. */
|
||||
if (_rl_uppercase_p (m->key) == 0)
|
||||
_rl_vi_doing_insert = 1;
|
||||
_rl_vi_doing_insert = 1;
|
||||
/* XXX -- TODO -- use m->numericarg? */
|
||||
rl_vi_start_inserting (m->key, rl_numeric_arg, rl_arg_sign);
|
||||
}
|
||||
@@ -1562,23 +1566,23 @@ rl_vi_char_search (count, key)
|
||||
else
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
case 't':
|
||||
_rl_cs_orig_dir = _rl_cs_dir = FTO;
|
||||
break;
|
||||
{
|
||||
case 't':
|
||||
_rl_cs_orig_dir = _rl_cs_dir = FTO;
|
||||
break;
|
||||
|
||||
case 'T':
|
||||
_rl_cs_orig_dir = _rl_cs_dir = BTO;
|
||||
break;
|
||||
case 'T':
|
||||
_rl_cs_orig_dir = _rl_cs_dir = BTO;
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
_rl_cs_orig_dir = _rl_cs_dir = FFIND;
|
||||
break;
|
||||
case 'f':
|
||||
_rl_cs_orig_dir = _rl_cs_dir = FFIND;
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
_rl_cs_orig_dir = _rl_cs_dir = BFIND;
|
||||
break;
|
||||
}
|
||||
case 'F':
|
||||
_rl_cs_orig_dir = _rl_cs_dir = BFIND;
|
||||
break;
|
||||
}
|
||||
|
||||
if (vi_redoing)
|
||||
{
|
||||
@@ -1586,12 +1590,12 @@ rl_vi_char_search (count, key)
|
||||
}
|
||||
#if defined (READLINE_CALLBACKS)
|
||||
else if (RL_ISSTATE (RL_STATE_CALLBACK))
|
||||
{
|
||||
_rl_callback_data = _rl_callback_data_alloc (count);
|
||||
_rl_callback_data->i1 = _rl_cs_dir;
|
||||
_rl_callback_func = _rl_vi_callback_char_search;
|
||||
return (0);
|
||||
}
|
||||
{
|
||||
_rl_callback_data = _rl_callback_data_alloc (count);
|
||||
_rl_callback_data->i1 = _rl_cs_dir;
|
||||
_rl_callback_func = _rl_vi_callback_char_search;
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
@@ -1642,7 +1646,7 @@ rl_vi_match (ignore, key)
|
||||
pre = rl_point;
|
||||
rl_forward_char (1, key);
|
||||
if (pre == rl_point)
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1671,7 +1675,7 @@ rl_vi_match (ignore, key)
|
||||
{
|
||||
pos = _rl_find_prev_mbchar (rl_line_buffer, pos, MB_FIND_ANY);
|
||||
if (tmp == pos)
|
||||
pos--;
|
||||
pos--;
|
||||
}
|
||||
if (pos >= 0)
|
||||
{
|
||||
@@ -1919,8 +1923,8 @@ rl_vi_replace (count, key)
|
||||
vi_replace_map[NEWLINE].function = rl_newline;
|
||||
|
||||
/* If the normal vi insertion keymap has ^H bound to erase, do the
|
||||
same here. Probably should remove the assignment to RUBOUT up
|
||||
there, but I don't think it will make a difference in real life. */
|
||||
same here. Probably should remove the assignment to RUBOUT up
|
||||
there, but I don't think it will make a difference in real life. */
|
||||
if (vi_insertion_keymap[CTRL ('H')].type == ISFUNC &&
|
||||
vi_insertion_keymap[CTRL ('H')].function == rl_rubout)
|
||||
vi_replace_map[CTRL ('H')].function = rl_vi_overstrike_delete;
|
||||
|
||||
+47
-43
@@ -630,12 +630,16 @@ _rl_vi_append_forward (key)
|
||||
if (MB_CUR_MAX == 1 || rl_byte_oriented)
|
||||
rl_point++;
|
||||
else
|
||||
{
|
||||
point = rl_point;
|
||||
rl_forward_char (1, key);
|
||||
if (point == rl_point)
|
||||
rl_point = rl_end;
|
||||
}
|
||||
{
|
||||
point = rl_point;
|
||||
#if 0
|
||||
rl_forward_char (1, key);
|
||||
#else
|
||||
_rl_forward_char_internal (1);
|
||||
#endif
|
||||
if (point == rl_point)
|
||||
rl_point = rl_end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -733,7 +737,7 @@ _rl_vi_done_inserting ()
|
||||
_rl_vi_last_key_before_insert == 'a' ||
|
||||
_rl_vi_last_key_before_insert == 'I' ||
|
||||
_rl_vi_last_key_before_insert == 'A'))
|
||||
_rl_vi_save_insert (rl_undo_list);
|
||||
_rl_vi_save_insert (rl_undo_list);
|
||||
/* XXX - Other keys probably need to be checked. */
|
||||
else if (_rl_vi_last_key_before_insert == 'C')
|
||||
rl_end_undo_group ();
|
||||
@@ -793,7 +797,7 @@ _rl_vi_change_mbchar_case (count)
|
||||
if (MB_INVALIDCH (m))
|
||||
wc = (wchar_t)rl_line_buffer[rl_point];
|
||||
else if (MB_NULLWCH (m))
|
||||
wc = L'\0';
|
||||
wc = L'\0';
|
||||
if (iswupper (wc))
|
||||
wc = towlower (wc);
|
||||
else if (iswlower (wc))
|
||||
@@ -821,7 +825,7 @@ _rl_vi_change_mbchar_case (count)
|
||||
rl_vi_check ();
|
||||
}
|
||||
else
|
||||
rl_forward_char (1, 0);
|
||||
rl_forward_char (1, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -868,7 +872,7 @@ rl_vi_change_case (count, ignore)
|
||||
_rl_insert_char (1, c);
|
||||
rl_end_undo_group ();
|
||||
rl_vi_check ();
|
||||
}
|
||||
}
|
||||
else
|
||||
rl_forward_char (1, c);
|
||||
}
|
||||
@@ -906,7 +910,7 @@ rl_vi_check ()
|
||||
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||
rl_point = _rl_find_prev_mbchar (rl_line_buffer, rl_point, MB_FIND_NONZERO);
|
||||
else
|
||||
rl_point--;
|
||||
rl_point--;
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
@@ -1011,7 +1015,7 @@ static void
|
||||
_rl_mvcxt_dispose (m)
|
||||
_rl_vimotion_cxt *m;
|
||||
{
|
||||
free (m);
|
||||
xfree (m);
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -1059,7 +1063,7 @@ rl_domove_motion_callback (m)
|
||||
/* Posix.2 says that if cw or cW moves the cursor towards the end of
|
||||
the line, the character under the cursor should be deleted. */
|
||||
if (rl_point == rl_mark)
|
||||
rl_point++;
|
||||
rl_point++;
|
||||
else
|
||||
{
|
||||
/* Move past the end of the word so that the kill doesn't
|
||||
@@ -1099,7 +1103,7 @@ rl_domove_read_callback (m)
|
||||
/* If we just read a vi-mode motion command numeric argument, turn off
|
||||
the `reading numeric arg' state */
|
||||
if (RL_ISSTATE (RL_STATE_CALLBACK) && RL_VIMOVENUMARG())
|
||||
RL_UNSETSTATE (RL_STATE_NUMERICARG);
|
||||
RL_UNSETSTATE (RL_STATE_NUMERICARG);
|
||||
#endif
|
||||
/* Should do everything, including turning off RL_STATE_VIMOTION */
|
||||
return (rl_domove_motion_callback (m));
|
||||
@@ -1137,10 +1141,10 @@ rl_domove_read_callback (m)
|
||||
rl_numeric_arg *= save;
|
||||
c = rl_vi_domove_getchar (m);
|
||||
if (c < 0)
|
||||
{
|
||||
m->motion = 0;
|
||||
return -1;
|
||||
}
|
||||
{
|
||||
m->motion = 0;
|
||||
return -1;
|
||||
}
|
||||
m->motion = c;
|
||||
return (rl_domove_motion_callback (m));
|
||||
}
|
||||
@@ -1288,7 +1292,7 @@ vi_change_dispatch (m)
|
||||
rl_kill_text (rl_point, rl_mark);
|
||||
/* `C' does not save the text inserted for undoing or redoing. */
|
||||
if (_rl_uppercase_p (m->key) == 0)
|
||||
_rl_vi_doing_insert = 1;
|
||||
_rl_vi_doing_insert = 1;
|
||||
/* XXX -- TODO -- use m->numericarg? */
|
||||
rl_vi_start_inserting (m->key, rl_numeric_arg, rl_arg_sign);
|
||||
}
|
||||
@@ -1562,23 +1566,23 @@ rl_vi_char_search (count, key)
|
||||
else
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
case 't':
|
||||
_rl_cs_orig_dir = _rl_cs_dir = FTO;
|
||||
break;
|
||||
{
|
||||
case 't':
|
||||
_rl_cs_orig_dir = _rl_cs_dir = FTO;
|
||||
break;
|
||||
|
||||
case 'T':
|
||||
_rl_cs_orig_dir = _rl_cs_dir = BTO;
|
||||
break;
|
||||
case 'T':
|
||||
_rl_cs_orig_dir = _rl_cs_dir = BTO;
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
_rl_cs_orig_dir = _rl_cs_dir = FFIND;
|
||||
break;
|
||||
case 'f':
|
||||
_rl_cs_orig_dir = _rl_cs_dir = FFIND;
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
_rl_cs_orig_dir = _rl_cs_dir = BFIND;
|
||||
break;
|
||||
}
|
||||
case 'F':
|
||||
_rl_cs_orig_dir = _rl_cs_dir = BFIND;
|
||||
break;
|
||||
}
|
||||
|
||||
if (vi_redoing)
|
||||
{
|
||||
@@ -1586,12 +1590,12 @@ rl_vi_char_search (count, key)
|
||||
}
|
||||
#if defined (READLINE_CALLBACKS)
|
||||
else if (RL_ISSTATE (RL_STATE_CALLBACK))
|
||||
{
|
||||
_rl_callback_data = _rl_callback_data_alloc (count);
|
||||
_rl_callback_data->i1 = _rl_cs_dir;
|
||||
_rl_callback_func = _rl_vi_callback_char_search;
|
||||
return (0);
|
||||
}
|
||||
{
|
||||
_rl_callback_data = _rl_callback_data_alloc (count);
|
||||
_rl_callback_data->i1 = _rl_cs_dir;
|
||||
_rl_callback_func = _rl_vi_callback_char_search;
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
@@ -1642,7 +1646,7 @@ rl_vi_match (ignore, key)
|
||||
pre = rl_point;
|
||||
rl_forward_char (1, key);
|
||||
if (pre == rl_point)
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1671,7 +1675,7 @@ rl_vi_match (ignore, key)
|
||||
{
|
||||
pos = _rl_find_prev_mbchar (rl_line_buffer, pos, MB_FIND_ANY);
|
||||
if (tmp == pos)
|
||||
pos--;
|
||||
pos--;
|
||||
}
|
||||
if (pos >= 0)
|
||||
{
|
||||
@@ -1919,8 +1923,8 @@ rl_vi_replace (count, key)
|
||||
vi_replace_map[NEWLINE].function = rl_newline;
|
||||
|
||||
/* If the normal vi insertion keymap has ^H bound to erase, do the
|
||||
same here. Probably should remove the assignment to RUBOUT up
|
||||
there, but I don't think it will make a difference in real life. */
|
||||
same here. Probably should remove the assignment to RUBOUT up
|
||||
there, but I don't think it will make a difference in real life. */
|
||||
if (vi_insertion_keymap[CTRL ('H')].type == ISFUNC &&
|
||||
vi_insertion_keymap[CTRL ('H')].function == rl_rubout)
|
||||
vi_replace_map[CTRL ('H')].function = rl_vi_overstrike_delete;
|
||||
|
||||
@@ -176,6 +176,8 @@ ansicstr (string, len, flags, sawc, rlen)
|
||||
else if ((flags & 1) == 0 && (c = *s))
|
||||
{
|
||||
s++;
|
||||
if ((flags & 2) && c == '\\' && c == *s)
|
||||
s++; /* Posix requires $'\c\\' do backslash escaping */
|
||||
c = TOCTRL(c);
|
||||
break;
|
||||
}
|
||||
|
||||
+6
-5
@@ -49,11 +49,9 @@ ansicstr (string, len, flags, sawc, rlen)
|
||||
char *string;
|
||||
int len, flags, *sawc, *rlen;
|
||||
{
|
||||
int c, temp, v;
|
||||
int c, temp;
|
||||
char *ret, *r, *s;
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
char mbch[25]; /* 25 > MB_LEN_MAX, plus can handle 4-byte UTF-8 and large Unicode characters*/
|
||||
#endif
|
||||
unsigned long v;
|
||||
|
||||
if (string == 0 || *string == '\0')
|
||||
return ((char *)NULL);
|
||||
@@ -153,7 +151,6 @@ ansicstr (string, len, flags, sawc, rlen)
|
||||
}
|
||||
else
|
||||
{
|
||||
memset (mbch, '\0', sizeof (mbch));
|
||||
temp = u32cconv (v, r);
|
||||
r += temp;
|
||||
continue;
|
||||
@@ -174,9 +171,13 @@ ansicstr (string, len, flags, sawc, rlen)
|
||||
*rlen = r - ret;
|
||||
return ret;
|
||||
}
|
||||
else if ((flags & 1) == 0 && *s == 0)
|
||||
; /* pass \c through */
|
||||
else if ((flags & 1) == 0 && (c = *s))
|
||||
{
|
||||
s++;
|
||||
if ((flags & 2) && c == '\\' && c == *s)
|
||||
s++; /*
|
||||
c = TOCTRL(c);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -3165,7 +3165,7 @@ parse_matched_pair (qc, open, close, lenp, flags)
|
||||
start_lineno = line_number;
|
||||
while (count)
|
||||
{
|
||||
ch = shell_getc (qc != '\'' && (tflags & LEX_PASSNEXT) == 0);
|
||||
ch = shell_getc (qc != '\'' && (tflags & (LEX_PASSNEXT)) == 0);
|
||||
|
||||
if (ch == EOF)
|
||||
{
|
||||
@@ -3434,7 +3434,7 @@ parse_comsub (qc, open, close, lenp, flags)
|
||||
while (count)
|
||||
{
|
||||
comsub_readchar:
|
||||
ch = shell_getc (qc != '\'' && (tflags & LEX_PASSNEXT) == 0);
|
||||
ch = shell_getc (qc != '\'' && (tflags & (LEX_INCOMMENT|LEX_PASSNEXT)) == 0);
|
||||
|
||||
if (ch == EOF)
|
||||
{
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
# This file is distributed under the same license as the bash package.
|
||||
# Göran Uddeborg <goeran@uddeborg.se>, 2008, 2009, 2010.
|
||||
#
|
||||
# $Revision: 1.8 $
|
||||
# $Revision: 1.9 $
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: bash 4.1\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2009-12-30 08:25-0500\n"
|
||||
"PO-Revision-Date: 2010-01-05 19:12+0100\n"
|
||||
"PO-Revision-Date: 2010-10-24 22:35+0200\n"
|
||||
"Last-Translator: Göran Uddeborg <goeran@uddeborg.se>\n"
|
||||
"Language-Team: Swedish <tp-sv@listor.tp-sv.se>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
@@ -1387,7 +1387,7 @@ msgstr "oväntad symbol %d i villkorligt kommando"
|
||||
#: parse.y:5459
|
||||
#, c-format
|
||||
msgid "syntax error near unexpected token `%s'"
|
||||
msgstr "syntaxfel när den oväntade symbolen \"%s\""
|
||||
msgstr "syntaxfel nära den oväntade symbolen \"%s\""
|
||||
|
||||
#: parse.y:5477
|
||||
#, c-format
|
||||
|
||||
@@ -62,13 +62,14 @@ extern int errno;
|
||||
int expanding_redir;
|
||||
|
||||
extern int posixly_correct;
|
||||
extern int last_command_exit_value;
|
||||
extern REDIRECT *redirection_undo_list;
|
||||
extern REDIRECT *exec_redirection_undo_list;
|
||||
|
||||
/* Static functions defined and used in this file. */
|
||||
static void add_undo_close_redirect __P((int));
|
||||
static void add_exec_redirect __P((REDIRECT *));
|
||||
static int add_undo_redirect __P((int, enum r_instruction, int));
|
||||
static int add_undo_close_redirect __P((int));
|
||||
static int expandable_redirection_filename __P((REDIRECT *));
|
||||
static int stdin_redirection __P((enum r_instruction, int));
|
||||
static int undoablefd __P((int));
|
||||
@@ -93,6 +94,13 @@ static REDIRECTEE rd;
|
||||
Used to print a reasonable error message. */
|
||||
static int heredoc_errno;
|
||||
|
||||
#define REDIRECTION_ERROR(r, e) \
|
||||
if ((r) != 0) \
|
||||
{ \
|
||||
last_command_exit_value = EXECUTION_FAILURE;\
|
||||
return ((e) == 0 ? EINVAL : (e));\
|
||||
}
|
||||
|
||||
void
|
||||
redirection_error (temp, error)
|
||||
REDIRECT *temp;
|
||||
@@ -813,9 +821,10 @@ do_redirection_internal (redirect, flags)
|
||||
{
|
||||
/* Only setup to undo it if the thing to undo is active. */
|
||||
if ((fd != redirector) && (fcntl (redirector, F_GETFD, 0) != -1))
|
||||
add_undo_redirect (redirector, ri, -1);
|
||||
r = add_undo_redirect (redirector, ri, -1);
|
||||
else
|
||||
add_undo_close_redirect (redirector);
|
||||
r = add_undo_close_redirect (redirector);
|
||||
REDIRECTION_ERROR (r, errno);
|
||||
}
|
||||
|
||||
#if defined (BUFFERED_INPUT)
|
||||
@@ -918,9 +927,10 @@ do_redirection_internal (redirect, flags)
|
||||
{
|
||||
/* Only setup to undo it if the thing to undo is active. */
|
||||
if ((fd != redirector) && (fcntl (redirector, F_GETFD, 0) != -1))
|
||||
add_undo_redirect (redirector, ri, -1);
|
||||
r = add_undo_redirect (redirector, ri, -1);
|
||||
else
|
||||
add_undo_close_redirect (redirector);
|
||||
r = add_undo_close_redirect (redirector);
|
||||
REDIRECTION_ERROR(r, errno);
|
||||
}
|
||||
|
||||
#if defined (BUFFERED_INPUT)
|
||||
@@ -972,9 +982,10 @@ do_redirection_internal (redirect, flags)
|
||||
{
|
||||
/* Only setup to undo it if the thing to undo is active. */
|
||||
if (fcntl (redirector, F_GETFD, 0) != -1)
|
||||
add_undo_redirect (redirector, ri, redir_fd);
|
||||
r = add_undo_redirect (redirector, ri, redir_fd);
|
||||
else
|
||||
add_undo_close_redirect (redirector);
|
||||
r = add_undo_close_redirect (redirector);
|
||||
REDIRECTION_ERROR(r, errno);
|
||||
}
|
||||
#if defined (BUFFERED_INPUT)
|
||||
check_bash_input (redirector);
|
||||
@@ -1046,8 +1057,10 @@ do_redirection_internal (redirect, flags)
|
||||
return AMBIGUOUS_REDIRECT;
|
||||
}
|
||||
|
||||
r = 0;
|
||||
if ((flags & RX_UNDOABLE) && (fcntl (redirector, F_GETFD, 0) != -1))
|
||||
add_undo_redirect (redirector, ri, -1);
|
||||
r = add_undo_redirect (redirector, ri, -1);
|
||||
REDIRECTION_ERROR (r, errno);
|
||||
|
||||
#if defined (COPROCESS_SUPPORT)
|
||||
coproc_fdchk (redirector);
|
||||
@@ -1164,7 +1177,7 @@ add_undo_redirect (fd, ri, fdbase)
|
||||
|
||||
/* Set up to close FD when we are finished with the current command
|
||||
and its redirections. */
|
||||
static void
|
||||
static int
|
||||
add_undo_close_redirect (fd)
|
||||
int fd;
|
||||
{
|
||||
@@ -1177,6 +1190,8 @@ add_undo_close_redirect (fd)
|
||||
closer->flags |= RX_INTERNAL;
|
||||
closer->next = redirection_undo_list;
|
||||
redirection_undo_list = closer;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -62,13 +62,14 @@ extern int errno;
|
||||
int expanding_redir;
|
||||
|
||||
extern int posixly_correct;
|
||||
extern int last_command_exit_value;
|
||||
extern REDIRECT *redirection_undo_list;
|
||||
extern REDIRECT *exec_redirection_undo_list;
|
||||
|
||||
/* Static functions defined and used in this file. */
|
||||
static void add_undo_close_redirect __P((int));
|
||||
static void add_exec_redirect __P((REDIRECT *));
|
||||
static int add_undo_redirect __P((int, enum r_instruction, int));
|
||||
static int add_undo_close_redirect __P((int));
|
||||
static int expandable_redirection_filename __P((REDIRECT *));
|
||||
static int stdin_redirection __P((enum r_instruction, int));
|
||||
static int undoablefd __P((int));
|
||||
@@ -93,6 +94,13 @@ static REDIRECTEE rd;
|
||||
Used to print a reasonable error message. */
|
||||
static int heredoc_errno;
|
||||
|
||||
#define REDIRECTION_ERROR(r, e) \
|
||||
if (r != 0) \
|
||||
{ \
|
||||
last_command_exit_value = EXECUTION_FAILURE;\
|
||||
return (e == 0 ? EINVAL : e);\
|
||||
}
|
||||
|
||||
void
|
||||
redirection_error (temp, error)
|
||||
REDIRECT *temp;
|
||||
@@ -638,8 +646,6 @@ redir_open (filename, flags, mode, ri)
|
||||
#endif /* AFS */
|
||||
}
|
||||
|
||||
itrace("redir_open: %s -> %d", filename, fd);
|
||||
|
||||
return fd;
|
||||
}
|
||||
|
||||
@@ -815,9 +821,10 @@ do_redirection_internal (redirect, flags)
|
||||
{
|
||||
/* Only setup to undo it if the thing to undo is active. */
|
||||
if ((fd != redirector) && (fcntl (redirector, F_GETFD, 0) != -1))
|
||||
add_undo_redirect (redirector, ri, -1);
|
||||
r = add_undo_redirect (redirector, ri, -1);
|
||||
else
|
||||
add_undo_close_redirect (redirector);
|
||||
r = add_undo_close_redirect (redirector);
|
||||
REDIRECTION_ERROR (r, errno);
|
||||
}
|
||||
|
||||
#if defined (BUFFERED_INPUT)
|
||||
@@ -920,9 +927,10 @@ do_redirection_internal (redirect, flags)
|
||||
{
|
||||
/* Only setup to undo it if the thing to undo is active. */
|
||||
if ((fd != redirector) && (fcntl (redirector, F_GETFD, 0) != -1))
|
||||
add_undo_redirect (redirector, ri, -1);
|
||||
r = add_undo_redirect (redirector, ri, -1);
|
||||
else
|
||||
add_undo_close_redirect (redirector);
|
||||
r = add_undo_close_redirect (redirector);
|
||||
REDIRECTION_ERROR(r, errno);
|
||||
}
|
||||
|
||||
#if defined (BUFFERED_INPUT)
|
||||
@@ -974,9 +982,10 @@ do_redirection_internal (redirect, flags)
|
||||
{
|
||||
/* Only setup to undo it if the thing to undo is active. */
|
||||
if (fcntl (redirector, F_GETFD, 0) != -1)
|
||||
add_undo_redirect (redirector, ri, redir_fd);
|
||||
r = add_undo_redirect (redirector, ri, redir_fd);
|
||||
else
|
||||
add_undo_close_redirect (redirector);
|
||||
r = add_undo_close_redirect (redirector);
|
||||
REDIRECTION_ERROR(r, errno);
|
||||
}
|
||||
#if defined (BUFFERED_INPUT)
|
||||
check_bash_input (redirector);
|
||||
@@ -1048,8 +1057,10 @@ do_redirection_internal (redirect, flags)
|
||||
return AMBIGUOUS_REDIRECT;
|
||||
}
|
||||
|
||||
r = 0;
|
||||
if ((flags & RX_UNDOABLE) && (fcntl (redirector, F_GETFD, 0) != -1))
|
||||
add_undo_redirect (redirector, ri, -1);
|
||||
r = add_undo_redirect (redirector, ri, -1);
|
||||
REDIRECTION_ERROR (r, errno);
|
||||
|
||||
#if defined (COPROCESS_SUPPORT)
|
||||
coproc_fdchk (redirector);
|
||||
@@ -1166,7 +1177,7 @@ add_undo_redirect (fd, ri, fdbase)
|
||||
|
||||
/* Set up to close FD when we are finished with the current command
|
||||
and its redirections. */
|
||||
static void
|
||||
static int
|
||||
add_undo_close_redirect (fd)
|
||||
int fd;
|
||||
{
|
||||
@@ -1179,6 +1190,8 @@ add_undo_close_redirect (fd)
|
||||
closer->flags |= RX_INTERNAL;
|
||||
closer->next = redirection_undo_list;
|
||||
redirection_undo_list = closer;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -59,6 +59,9 @@ extern int loop_level, continuing, breaking, funcnest;
|
||||
extern int executing_list;
|
||||
extern int comsub_ignore_return;
|
||||
extern int parse_and_execute_level, shell_initialized;
|
||||
#if defined (HISTORY)
|
||||
extern int history_lines_this_session;
|
||||
#endif
|
||||
|
||||
extern void intialize_siglist ();
|
||||
|
||||
@@ -500,6 +503,10 @@ termsig_sighandler (sig)
|
||||
/* XXX - should this also trigger when interrupt_immediately is set? */
|
||||
if (terminate_immediately)
|
||||
{
|
||||
#if defined (HISTORY)
|
||||
/* XXX - will inhibit history file being written */
|
||||
history_lines_this_session = 0;
|
||||
#endif
|
||||
terminate_immediately = 0;
|
||||
termsig_handler (sig);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* sig.c - interface for shell signal handlers and signal initialization. */
|
||||
|
||||
/* Copyright (C) 1994-2009 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1994-2010 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -500,6 +500,9 @@ termsig_sighandler (sig)
|
||||
/* XXX - should this also trigger when interrupt_immediately is set? */
|
||||
if (terminate_immediately)
|
||||
{
|
||||
#if defined (HISTORY)
|
||||
/* XXX - history_lines_this_session = 0 will inhibit history file being written */
|
||||
#endif
|
||||
terminate_immediately = 0;
|
||||
termsig_handler (sig);
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ extern int errno;
|
||||
/* Evaluates to 1 if C is one of the shell's special parameters for which an
|
||||
indirect variable reference may be made. */
|
||||
#define VALID_INDIR_PARAM(c) \
|
||||
((c) == '#' || (c) == '?' || (c) == '@' || (c) == '*')
|
||||
((posixly_correct == 0 && (c) == '#') || (posixly_correct == 0 && (c) == '?') || (c) == '@' || (c) == '*')
|
||||
|
||||
/* Evaluates to 1 if C is one of the OP characters that follows the parameter
|
||||
in ${parameter[:]OPword}. */
|
||||
@@ -5907,7 +5907,7 @@ parameter_brace_expand_length (name)
|
||||
break;
|
||||
case '!':
|
||||
if (last_asynchronous_pid == NO_PID)
|
||||
t = (char *)NULL;
|
||||
t = (char *)NULL; /* XXX - error if set -u set? */
|
||||
else
|
||||
t = itos (last_asynchronous_pid);
|
||||
break;
|
||||
@@ -5929,6 +5929,8 @@ parameter_brace_expand_length (name)
|
||||
if (legal_number (name + 1, &arg_index)) /* ${#1} */
|
||||
{
|
||||
t = get_dollar_var_value (arg_index);
|
||||
if (t == 0 && unbound_vars_is_error)
|
||||
return INTMAX_MIN;
|
||||
number = MB_STRLEN (t);
|
||||
FREE (t);
|
||||
}
|
||||
@@ -5939,6 +5941,8 @@ parameter_brace_expand_length (name)
|
||||
t = assoc_reference (assoc_cell (var), "0");
|
||||
else
|
||||
t = array_reference (array_cell (var), 0);
|
||||
if (t == 0 && unbound_vars_is_error)
|
||||
return INTMAX_MIN;
|
||||
number = MB_STRLEN (t);
|
||||
}
|
||||
#endif
|
||||
@@ -6940,15 +6944,8 @@ parameter_brace_expand (string, indexp, quoted, pflags, quoted_dollar_atp, conta
|
||||
/* If the name really consists of a special variable, then make sure
|
||||
that we have the entire name. We don't allow indirect references
|
||||
to special variables except `#', `?', `@' and `*'. */
|
||||
if ((sindex == t_index &&
|
||||
(string[t_index] == '-' ||
|
||||
string[t_index] == '?' ||
|
||||
string[t_index] == '#')) ||
|
||||
(sindex == t_index - 1 && string[sindex] == '!' &&
|
||||
(string[t_index] == '#' ||
|
||||
string[t_index] == '?' ||
|
||||
string[t_index] == '@' ||
|
||||
string[t_index] == '*')))
|
||||
if ((sindex == t_index && VALID_SPECIAL_LENGTH_PARAM (string[t_index])) ||
|
||||
(sindex == t_index - 1 && string[sindex] == '!' && VALID_INDIR_PARAM (string[t_index])))
|
||||
{
|
||||
t_index++;
|
||||
free (name);
|
||||
@@ -7043,6 +7040,13 @@ parameter_brace_expand (string, indexp, quoted, pflags, quoted_dollar_atp, conta
|
||||
}
|
||||
|
||||
number = parameter_brace_expand_length (name);
|
||||
if (number == INTMAX_MIN && unbound_vars_is_error)
|
||||
{
|
||||
last_command_exit_value = EXECUTION_FAILURE;
|
||||
err_unboundvar (name+1);
|
||||
free (name);
|
||||
return (interactive_shell ? &expand_wdesc_error : &expand_wdesc_fatal);
|
||||
}
|
||||
free (name);
|
||||
|
||||
*indexp = sindex;
|
||||
@@ -7178,6 +7182,21 @@ parameter_brace_expand (string, indexp, quoted, pflags, quoted_dollar_atp, conta
|
||||
|
||||
*indexp = sindex;
|
||||
|
||||
/* All the cases where an expansion can possibly generate an unbound
|
||||
variable error. */
|
||||
if (want_substring || want_patsub || want_casemod || c == '#' || c == '%' || c == RBRACE)
|
||||
{
|
||||
if (var_is_set == 0 && unbound_vars_is_error && ((name[0] != '@' && name[0] != '*') || name[1]))
|
||||
{
|
||||
last_command_exit_value = EXECUTION_FAILURE;
|
||||
err_unboundvar (name);
|
||||
FREE (value);
|
||||
FREE (temp);
|
||||
free (name);
|
||||
return (interactive_shell ? &expand_wdesc_error : &expand_wdesc_fatal);
|
||||
}
|
||||
}
|
||||
|
||||
/* If this is a substring spec, process it and add the result. */
|
||||
if (want_substring)
|
||||
{
|
||||
@@ -7251,15 +7270,6 @@ parameter_brace_expand (string, indexp, quoted, pflags, quoted_dollar_atp, conta
|
||||
return &expand_wdesc_error;
|
||||
|
||||
case RBRACE:
|
||||
if (var_is_set == 0 && unbound_vars_is_error && ((name[0] != '@' && name[0] != '*') || name[1]))
|
||||
{
|
||||
last_command_exit_value = EXECUTION_FAILURE;
|
||||
err_unboundvar (name);
|
||||
FREE (value);
|
||||
FREE (temp);
|
||||
free (name);
|
||||
return (interactive_shell ? &expand_wdesc_error : &expand_wdesc_fatal);
|
||||
}
|
||||
break;
|
||||
|
||||
case '#': /* ${param#[#]pattern} */
|
||||
@@ -9324,6 +9334,7 @@ expand_word_list_internal (list, eflags)
|
||||
if ((eflags & WEXP_VARASSIGN) && subst_assign_varlist)
|
||||
{
|
||||
sh_wassign_func_t *assign_func;
|
||||
int is_special_builtin;
|
||||
|
||||
/* If the remainder of the words expand to nothing, Posix.2 requires
|
||||
that the variable and environment assignments affect the shell's
|
||||
@@ -9331,6 +9342,10 @@ expand_word_list_internal (list, eflags)
|
||||
assign_func = new_list ? assign_in_env : do_word_assignment;
|
||||
tempenv_assign_error = 0;
|
||||
|
||||
/* Posix says that special builtins exit if a variable assignment error
|
||||
occurs in an assignment preceding it. */
|
||||
is_special_builtin = (posixly_correct && new_list && find_special_builtin (new_list->word->word));
|
||||
|
||||
for (temp_list = subst_assign_varlist; temp_list; temp_list = temp_list->next)
|
||||
{
|
||||
this_command_name = (char *)NULL;
|
||||
@@ -9344,7 +9359,7 @@ expand_word_list_internal (list, eflags)
|
||||
if (assign_func == do_word_assignment)
|
||||
{
|
||||
last_command_exit_value = EXECUTION_FAILURE;
|
||||
if (interactive_shell == 0 && posixly_correct)
|
||||
if (interactive_shell == 0 && posixly_correct && is_special_builtin)
|
||||
exp_jump_to_top_level (FORCE_EOF);
|
||||
else
|
||||
exp_jump_to_top_level (DISCARD);
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
BUILD_DIR=/usr/local/build/chet/bash/bash-current
|
||||
BUILD_DIR=/usr/local/build/bash/bash-current
|
||||
THIS_SH=$BUILD_DIR/bash
|
||||
PATH=$PATH:$BUILD_DIR
|
||||
|
||||
|
||||
+5
-4
@@ -200,14 +200,15 @@ ok
|
||||
4
|
||||
10000
|
||||
10000
|
||||
2147483649
|
||||
8 12
|
||||
./arith.tests: line 275: ((: x=9 y=41 : syntax error in expression (error token is "y=41 ")
|
||||
./arith.tests: line 279: a b: syntax error in expression (error token is "b")
|
||||
./arith.tests: line 280: ((: a b: syntax error in expression (error token is "b")
|
||||
./arith.tests: line 278: ((: x=9 y=41 : syntax error in expression (error token is "y=41 ")
|
||||
./arith.tests: line 282: a b: syntax error in expression (error token is "b")
|
||||
./arith.tests: line 283: ((: a b: syntax error in expression (error token is "b")
|
||||
42
|
||||
42
|
||||
42
|
||||
42
|
||||
42
|
||||
42
|
||||
./arith.tests: line 291: b[c]d: syntax error in expression (error token is "d")
|
||||
./arith.tests: line 294: b[c]d: syntax error in expression (error token is "d")
|
||||
|
||||
@@ -264,6 +264,9 @@ ${THIS_SH} ./arith1.sub
|
||||
${THIS_SH} ./arith2.sub
|
||||
${THIS_SH} ./arith3.sub
|
||||
|
||||
# make sure arithmetic expansion handles ints > 2**31 - 1 using intmax_t
|
||||
echo $(( 2147483645 + 4 ))
|
||||
|
||||
x=4
|
||||
y=7
|
||||
|
||||
|
||||
@@ -0,0 +1,291 @@
|
||||
set +o posix
|
||||
declare -i iv jv
|
||||
|
||||
iv=$(( 3 + 5 * 32 ))
|
||||
echo $iv
|
||||
iv=iv+3
|
||||
echo $iv
|
||||
iv=2
|
||||
jv=iv
|
||||
|
||||
let "jv *= 2"
|
||||
echo $jv
|
||||
jv=$(( $jv << 2 ))
|
||||
echo $jv
|
||||
|
||||
let jv="$jv / 2"
|
||||
echo $jv
|
||||
jv="jv >> 2"
|
||||
echo $jv
|
||||
|
||||
iv=$((iv+ $jv))
|
||||
echo $iv
|
||||
echo $((iv -= jv))
|
||||
echo $iv
|
||||
echo $(( iv == jv ))
|
||||
echo $(( iv != $jv ))
|
||||
echo $(( iv < jv ))
|
||||
echo $(( $iv > $jv ))
|
||||
echo $(( iv <= $jv ))
|
||||
echo $(( $iv >= jv ))
|
||||
|
||||
echo $jv
|
||||
echo $(( ~$jv ))
|
||||
echo $(( ~1 ))
|
||||
echo $(( ! 0 ))
|
||||
|
||||
echo $(( jv % 2 ))
|
||||
echo $(( $iv % 4 ))
|
||||
|
||||
echo $(( iv <<= 16 ))
|
||||
echo $(( iv %= 33 ))
|
||||
|
||||
echo $(( 33 & 55 ))
|
||||
echo $(( 33 | 17 ))
|
||||
|
||||
echo $(( iv && $jv ))
|
||||
echo $(( $iv || jv ))
|
||||
|
||||
echo $(( iv && 0 ))
|
||||
echo $(( iv & 0 ))
|
||||
echo $(( iv && 1 ))
|
||||
echo $(( iv & 1 ))
|
||||
|
||||
echo $(( $jv || 0 ))
|
||||
echo $(( jv | 0 ))
|
||||
echo $(( jv | 1 ))
|
||||
echo $(( $jv || 1 ))
|
||||
|
||||
let 'iv *= jv'
|
||||
echo $iv
|
||||
echo $jv
|
||||
let "jv += $iv"
|
||||
echo $jv
|
||||
|
||||
echo $(( jv /= iv ))
|
||||
echo $(( jv <<= 8 ))
|
||||
echo $(( jv >>= 4 ))
|
||||
|
||||
echo $(( iv |= 4 ))
|
||||
echo $(( iv &= 4 ))
|
||||
|
||||
echo $(( iv += (jv + 9)))
|
||||
echo $(( (iv + 4) % 7 ))
|
||||
|
||||
# unary plus, minus
|
||||
echo $(( +4 - 8 ))
|
||||
echo $(( -4 + 8 ))
|
||||
|
||||
# conditional expressions
|
||||
echo $(( 4<5 ? 1 : 32))
|
||||
echo $(( 4>5 ? 1 : 32))
|
||||
echo $(( 4>(2+3) ? 1 : 32))
|
||||
echo $(( 4<(2+3) ? 1 : 32))
|
||||
echo $(( (2+2)<(2+3) ? 1 : 32))
|
||||
echo $(( (2+2)>(2+3) ? 1 : 32))
|
||||
|
||||
# bug in bash versions through bash-3.2
|
||||
S=105
|
||||
W=$((S>99?4:S>9?3:S>0?2:0))
|
||||
echo $W
|
||||
unset W S
|
||||
|
||||
# check that the unevaluated part of the ternary operator does not do
|
||||
# evaluation or assignment
|
||||
x=i+=2
|
||||
y=j+=2
|
||||
declare -i i=1 j=1
|
||||
echo $((1 ? 20 : (x+=2)))
|
||||
echo $i,$x
|
||||
echo $((0 ? (y+=2) : 30))
|
||||
echo $j,$y
|
||||
|
||||
x=i+=2
|
||||
y=j+=2
|
||||
declare -i i=1 j=1
|
||||
echo $((1 ? 20 : (x+=2)))
|
||||
echo $i,$x
|
||||
echo $((0 ? (y+=2) : 30))
|
||||
echo $i,$y
|
||||
|
||||
# check precedence of assignment vs. conditional operator
|
||||
# should be an error
|
||||
declare -i x=2
|
||||
y=$((1 ? 20 : x+=2))
|
||||
|
||||
# check precedence of assignment vs. conditional operator
|
||||
declare -i x=2
|
||||
echo $((0 ? x+=2 : 20))
|
||||
|
||||
# associativity of assignment-operator operator
|
||||
declare -i i=1 j=2 k=3
|
||||
echo $((i += j += k))
|
||||
echo $i,$j,$k
|
||||
|
||||
# octal, hex
|
||||
echo $(( 0x100 | 007 ))
|
||||
echo $(( 0xff ))
|
||||
echo $(( 16#ff ))
|
||||
echo $(( 16#FF/2 ))
|
||||
echo $(( 8#44 ))
|
||||
|
||||
echo $(( 8 ^ 32 ))
|
||||
|
||||
# other bases
|
||||
echo $(( 16#a ))
|
||||
echo $(( 32#a ))
|
||||
echo $(( 56#a ))
|
||||
echo $(( 64#a ))
|
||||
|
||||
echo $(( 16#A ))
|
||||
echo $(( 32#A ))
|
||||
echo $(( 56#A ))
|
||||
echo $(( 64#A ))
|
||||
|
||||
echo $(( 64#@ ))
|
||||
echo $(( 64#_ ))
|
||||
|
||||
# weird bases
|
||||
echo $(( 3425#56 ))
|
||||
|
||||
# missing number after base
|
||||
echo $(( 2# ))
|
||||
|
||||
# these should generate errors
|
||||
echo $(( 7 = 43 ))
|
||||
echo $(( 2#44 ))
|
||||
echo $(( 44 / 0 ))
|
||||
let 'jv += $iv'
|
||||
echo $(( jv += \$iv ))
|
||||
let 'rv = 7 + (43 * 6'
|
||||
|
||||
# more errors
|
||||
declare -i i
|
||||
i=0#4
|
||||
i=2#110#11
|
||||
|
||||
((echo abc; echo def;); echo ghi)
|
||||
|
||||
if (((4+4) + (4 + 7))); then
|
||||
echo ok
|
||||
fi
|
||||
|
||||
(()) # make sure the null expression works OK
|
||||
|
||||
a=(0 2 4 6)
|
||||
echo $(( a[1] + a[2] ))
|
||||
echo $(( (a[1] + a[2]) == a[3] ))
|
||||
(( (a[1] + a[2]) == a[3] )) ; echo $?
|
||||
|
||||
# test pushing and popping the expression stack
|
||||
unset A
|
||||
A="4 + "
|
||||
echo $(( ( 4 + A ) + 4 ))
|
||||
A="3 + 5"
|
||||
echo $(( ( 4 + A ) + 4 ))
|
||||
|
||||
# badly-formed conditional expressions
|
||||
echo $(( 4 ? : $A ))
|
||||
echo $(( 1 ? 20 ))
|
||||
echo $(( 4 ? 20 : ))
|
||||
|
||||
# precedence and short-circuit evaluation
|
||||
B=9
|
||||
echo $B
|
||||
|
||||
echo $(( 0 && B=42 ))
|
||||
echo $B
|
||||
|
||||
echo $(( 1 || B=88 ))
|
||||
echo $B
|
||||
|
||||
echo $(( 0 && (B=42) ))
|
||||
echo $B
|
||||
|
||||
echo $(( (${$} - $$) && (B=42) ))
|
||||
echo $B
|
||||
|
||||
echo $(( 1 || (B=88) ))
|
||||
echo $B
|
||||
|
||||
# until command with (( )) command
|
||||
x=7
|
||||
|
||||
echo $x
|
||||
until (( x == 4 ))
|
||||
do
|
||||
echo $x
|
||||
x=4
|
||||
done
|
||||
|
||||
echo $x
|
||||
|
||||
# exponentiation
|
||||
echo $(( 2**15 - 1))
|
||||
echo $(( 2**(16-1)))
|
||||
echo $(( 2**16*2 ))
|
||||
echo $(( 2**31-1))
|
||||
echo $(( 2**0 ))
|
||||
|
||||
# {pre,post}-{inc,dec}rement and associated errors
|
||||
|
||||
x=4
|
||||
|
||||
echo $x
|
||||
echo $(( x++ ))
|
||||
echo $x
|
||||
echo $(( x-- ))
|
||||
echo $x
|
||||
|
||||
echo $(( --x ))
|
||||
echo $x
|
||||
|
||||
echo $(( ++x ))
|
||||
echo $x
|
||||
|
||||
echo $(( ++7 ))
|
||||
echo $(( 7-- ))
|
||||
|
||||
echo $(( --x=7 ))
|
||||
echo $(( ++x=7 ))
|
||||
|
||||
echo $(( x++=7 ))
|
||||
echo $(( x--=7 ))
|
||||
|
||||
echo $x
|
||||
|
||||
echo $(( +7 ))
|
||||
echo $(( -7 ))
|
||||
|
||||
echo $(( ++7 ))
|
||||
echo $(( --7 ))
|
||||
|
||||
${THIS_SH} ./arith1.sub
|
||||
${THIS_SH} ./arith2.sub
|
||||
${THIS_SH} ./arith3.sub
|
||||
|
||||
x=4
|
||||
y=7
|
||||
|
||||
(( x=8 , y=12 ))
|
||||
|
||||
echo $x $y
|
||||
|
||||
# should be an error
|
||||
(( x=9 y=41 ))
|
||||
|
||||
# These are errors
|
||||
unset b
|
||||
echo $((a b))
|
||||
((a b))
|
||||
|
||||
n=42
|
||||
printf "%d\n" $n
|
||||
printf "%i\n" $n
|
||||
echo $(( 8#$(printf "%o\n" $n) ))
|
||||
printf "%u\n" $n
|
||||
echo $(( 16#$(printf "%x\n" $n) ))
|
||||
echo $(( 16#$(printf "%X\n" $n) ))
|
||||
|
||||
# causes longjmp botches through bash-2.05b
|
||||
a[b[c]d]=e
|
||||
@@ -57,6 +57,7 @@ a-{bdef-g-c a-{bdef-i-c
|
||||
a b c d e f g h i j k l m n o p q r s t u v w x y z
|
||||
a c e g i k m o q s u w y
|
||||
z x v t r p n l j h f d b
|
||||
2147483645 2147483646 2147483647 2147483648 2147483649
|
||||
10 8 6 4 2 0
|
||||
10 8 6 4 2 0
|
||||
-50 -45 -40 -35 -30 -25 -20 -15 -10 -5 0
|
||||
|
||||
@@ -94,6 +94,9 @@ echo {a..z}
|
||||
echo {a..z..2}
|
||||
echo {z..a..-2}
|
||||
|
||||
# make sure brace expansion handles ints > 2**31 - 1 using intmax_t
|
||||
echo {2147483645..2147483649}
|
||||
|
||||
# unwanted zero-padding -- fixed post-bash-4.0
|
||||
echo {10..0..2}
|
||||
echo {10..0..-2}
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
echo ff{c,b,a}
|
||||
echo f{d,e,f}g
|
||||
echo {l,n,m}xyz
|
||||
echo {abc\,def}
|
||||
echo {abc}
|
||||
|
||||
echo \{a,b,c,d,e}
|
||||
echo {x,y,\{a,b,c}}
|
||||
echo {x\,y,\{abc\},trie}
|
||||
|
||||
echo /usr/{ucb/{ex,edit},lib/{ex,how_ex}}
|
||||
|
||||
echo XXXX\{`echo a b c | tr ' ' ','`\}
|
||||
eval echo XXXX\{`echo a b c | tr ' ' ','`\}
|
||||
|
||||
echo {}
|
||||
echo { }
|
||||
echo }
|
||||
echo {
|
||||
echo abcd{efgh
|
||||
|
||||
echo foo {1,2} bar
|
||||
echo `zecho foo {1,2} bar`
|
||||
echo $(zecho foo {1,2} bar)
|
||||
|
||||
var=baz
|
||||
varx=vx
|
||||
vary=vy
|
||||
|
||||
echo foo{bar,${var}.}
|
||||
echo foo{bar,${var}}
|
||||
|
||||
echo "${var}"{x,y}
|
||||
echo $var{x,y}
|
||||
echo ${var}{x,y}
|
||||
|
||||
unset var varx vary
|
||||
|
||||
# new sequence brace operators
|
||||
echo {1..10}
|
||||
|
||||
# this doesn't work yet
|
||||
echo {0..10,braces}
|
||||
# but this does
|
||||
echo {{0..10},braces}
|
||||
echo x{{0..10},braces}y
|
||||
|
||||
echo {3..3}
|
||||
echo x{3..3}y
|
||||
echo {10..1}
|
||||
echo {10..1}y
|
||||
echo x{10..1}y
|
||||
|
||||
echo {a..f}
|
||||
echo {f..a}
|
||||
|
||||
echo {a..A}
|
||||
echo {A..a}
|
||||
|
||||
echo {f..f}
|
||||
|
||||
# mixes are incorrectly-formed brace expansions
|
||||
echo {1..f}
|
||||
echo {f..1}
|
||||
|
||||
echo 0{1..9} {10..20}
|
||||
|
||||
# do negative numbers work?
|
||||
echo {-1..-10}
|
||||
echo {-20..0}
|
||||
|
||||
# weirdly-formed brace expansions -- fixed in post-bash-3.1
|
||||
echo a-{b{d,e}}-c
|
||||
|
||||
echo a-{bdef-{g,i}-c
|
||||
|
||||
echo {"klklkl"}{1,2,3}
|
||||
echo {"x,x"}
|
||||
|
||||
echo {1..10..2}
|
||||
echo {-1..-10..2}
|
||||
echo {-1..-10..-2}
|
||||
|
||||
echo {10..1..-2}
|
||||
echo {10..1..2}
|
||||
|
||||
echo {1..20..2}
|
||||
echo {1..20..20}
|
||||
|
||||
echo {100..0..5}
|
||||
echo {100..0..-5}
|
||||
|
||||
echo {a..z}
|
||||
echo {a..z..2}
|
||||
echo {z..a..-2}
|
||||
|
||||
# make sure brace expansion handles ints > 2**31 - 1 using intmax_t
|
||||
echo {2147483645..2147483649}
|
||||
|
||||
# unwanted zero-padding -- fixed post-bash-4.0
|
||||
echo {10..0..2}
|
||||
echo {10..0..-2}
|
||||
echo {-50..-0..5}
|
||||
|
||||
# bad
|
||||
echo {1..10.f}
|
||||
echo {1..ff}
|
||||
echo {1..10..ff}
|
||||
echo {1.20..2}
|
||||
echo {1..20..f2}
|
||||
echo {1..20..2f}
|
||||
echo {1..2f..2}
|
||||
echo {1..ff..2}
|
||||
echo {1..ff}
|
||||
echo {1..f}
|
||||
echo {1..0f}
|
||||
echo {1..10f}
|
||||
echo {1..10.f}
|
||||
echo {1..10.f}
|
||||
@@ -70,3 +70,4 @@ swap32_posix ()
|
||||
));
|
||||
done
|
||||
}
|
||||
yes
|
||||
|
||||
@@ -205,6 +205,14 @@ ${THIS_SH} ./comsub-posix3.sub
|
||||
# produced a parse error through bash-4.0-beta2
|
||||
: $(echo foo)"
|
||||
"
|
||||
# produced a parse error through bash-4.1
|
||||
unset x
|
||||
x=$(
|
||||
echo yes
|
||||
# a comment with " ' \
|
||||
)
|
||||
echo $x
|
||||
unset x
|
||||
|
||||
# fixed after bash-4.0 released
|
||||
: $(case a in a) echo ;; # comment
|
||||
|
||||
@@ -200,6 +200,8 @@ ${THIS_SH} ./comsub-posix1.sub
|
||||
|
||||
${THIS_SH} ./comsub-posix2.sub
|
||||
|
||||
${THIS_SH} ./comsub-posix3.sub
|
||||
|
||||
# produced a parse error through bash-4.0-beta2
|
||||
: $(echo foo)"
|
||||
"
|
||||
|
||||
@@ -115,3 +115,10 @@ echo after
|
||||
|
||||
# Problem with bash at least back to version 3.0
|
||||
${THIS_SH} -c 'VAR=0; VAR=1 command exec; exit ${VAR}'
|
||||
|
||||
# problem with bash through bash-4.1
|
||||
(
|
||||
exec /var/empty/nosuch
|
||||
echo bad
|
||||
) 2>/dev/null
|
||||
[ $? = 127 ] || echo FAIL: bad exit status $? at $LINENO
|
||||
|
||||
@@ -113,4 +113,12 @@ true | `echo true` &
|
||||
|
||||
echo after
|
||||
|
||||
# Problem with bash at least back to version 3.0
|
||||
${THIS_SH} -c 'VAR=0; VAR=1 command exec; exit ${VAR}'
|
||||
|
||||
# problem with bash through bash-4.1
|
||||
(
|
||||
exec /var/empty/nosuch
|
||||
echo bad
|
||||
) 2>/dev/null
|
||||
[ $? = 127 ] || echo exit status = $? at $LINENO
|
||||
|
||||
@@ -37,5 +37,5 @@ argv[1] = <'bar>
|
||||
argv[1] = <foo 'bar baz>
|
||||
argv[1] = <}z>
|
||||
argv[1] = <''z}>
|
||||
./posixexp.tests: line 68: unexpected EOF while looking for matching `}'
|
||||
./posixexp.tests: line 69: syntax error: unexpected end of file
|
||||
./posixexp.tests: line 77: unexpected EOF while looking for matching `}'
|
||||
./posixexp.tests: line 78: syntax error: unexpected end of file
|
||||
|
||||
@@ -63,6 +63,15 @@ recho "foo ${IFS+'bar} baz"
|
||||
recho ${IFS+'}'z}
|
||||
recho "${IFS+'}'z}"
|
||||
|
||||
: ${TMPDIR:=/var/tmp}
|
||||
rm -f $TMPDIR/sh
|
||||
cp ${THIS_SH} $TMPDIR/sh
|
||||
THIS_SH=$TMPDIR/sh ${THIS_SH} ./posixexp1.sub || echo "sh posixexp1.sub: test $? failed"
|
||||
${THIS_SH} ./posixexp1.sub || echo "bash posixexp1.sub: test $? failed"
|
||||
|
||||
THIS_SH=$TMPDIR/sh ${THIS_SH} ./posixexp2.sub || echo "sh posixexp2.sub: test $? failed"
|
||||
rm -f $TMPDIR/sh
|
||||
|
||||
# this will be an error
|
||||
foo=bar
|
||||
echo "${foo:-"a}"
|
||||
|
||||
@@ -1,3 +1,15 @@
|
||||
unset a
|
||||
printf "%s\n" ${a:=a\ b}
|
||||
echo "$a"
|
||||
|
||||
unset v
|
||||
recho ${v=a\ b} x ${v=c\ d}
|
||||
|
||||
unset v
|
||||
recho "${v=a\ b}" x "${v=c\ d}"
|
||||
|
||||
unset a v
|
||||
|
||||
recho "foo ${IFS+'bar'} baz"
|
||||
recho "a ${IFS+b c} d"
|
||||
|
||||
@@ -51,6 +63,14 @@ recho "foo ${IFS+'bar} baz"
|
||||
recho ${IFS+'}'z}
|
||||
recho "${IFS+'}'z}"
|
||||
|
||||
: ${TMPDIR:=/var/tmp}
|
||||
rm -f $TMPDIR/sh
|
||||
cp ${THIS_SH} $TMPDIR/sh
|
||||
THIS_SH=$TMPDIR/sh ${THIS_SH} ./posixexp1.sub || echo "sh posixexp1.sub: test $? failed"
|
||||
${THIS_SH} ./posixexp1.sub || echo "bash posixexp1.sub: test $? failed"
|
||||
|
||||
rm -f $TMPDIR/sh
|
||||
|
||||
# this will be an error
|
||||
foo=bar
|
||||
echo "${foo:-"a}"
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
# $FreeBSD: src/tools/regression/bin/sh/expansion/set-u1.0,v 1.2 2010/10/12 18:20:38 obrien Exp $
|
||||
|
||||
${THIS_SH} -uc 'unset foo; echo ${foo}' 2>/dev/null && exit 1
|
||||
${THIS_SH} -uc 'unset foo; echo $foo' 2>/dev/null && exit 1
|
||||
${THIS_SH} -uc 'foo=; echo $foo' >/dev/null || exit 2
|
||||
${THIS_SH} -uc 'foo=1; echo $foo' >/dev/null || exit 3
|
||||
# -/+/= are unaffected by set -u
|
||||
${THIS_SH} -uc 'unset foo; echo ${foo-}' >/dev/null || exit 4
|
||||
${THIS_SH} -uc 'unset foo; echo ${foo+}' >/dev/null || exit 5
|
||||
${THIS_SH} -uc 'unset foo; echo ${foo=}' >/dev/null || exit 6
|
||||
# length/trimming are affected
|
||||
${THIS_SH} -uc 'unset foo; echo ${#foo}' 2>/dev/null && exit 7
|
||||
${THIS_SH} -uc 'foo=; echo ${#foo}' >/dev/null || exit 8
|
||||
${THIS_SH} -uc 'unset foo; echo ${foo#?}' 2>/dev/null && exit 9
|
||||
${THIS_SH} -uc 'foo=1; echo ${foo#?}' >/dev/null || exit 10
|
||||
${THIS_SH} -uc 'unset foo; echo ${foo##?}' 2>/dev/null && exit 11
|
||||
${THIS_SH} -uc 'foo=1; echo ${foo##?}' >/dev/null || exit 12
|
||||
${THIS_SH} -uc 'unset foo; echo ${foo%?}' 2>/dev/null && exit 13
|
||||
${THIS_SH} -uc 'foo=1; echo ${foo%?}' >/dev/null || exit 14
|
||||
${THIS_SH} -uc 'unset foo; echo ${foo%%?}' 2>/dev/null && exit 15
|
||||
${THIS_SH} -uc 'foo=1; echo ${foo%%?}' >/dev/null || exit 16
|
||||
|
||||
${THIS_SH} -uc 'echo $!' 2>/dev/null && exit 17
|
||||
${THIS_SH} -uc ':& echo $!' >/dev/null || exit 18
|
||||
${THIS_SH} -uc 'echo $#' >/dev/null || exit 19
|
||||
${THIS_SH} -uc 'echo $1' 2>/dev/null && exit 20
|
||||
${THIS_SH} -uc 'echo $1' ${THIS_SH} xnotthere >/dev/null || exit 21
|
||||
${THIS_SH} -uc 'echo $2' ${THIS_SH} xnotthere 2>/dev/null && exit 22
|
||||
${THIS_SH} -uc 'echo $2' ${THIS_SH} xnotthere ynotthere >/dev/null || exit 23
|
||||
exit 0
|
||||
@@ -0,0 +1,30 @@
|
||||
# $FreeBSD: src/tools/regression/bin/sh/expansion/set-u1.0,v 1.2 2010/10/12 18:20:38 obrien Exp $
|
||||
|
||||
${THIS_SH} -uc 'unset foo; echo ${foo}' 2>/dev/null && exit 1
|
||||
${THIS_SH} -uc 'unset foo; echo $foo' 2>/dev/null && exit 1
|
||||
${THIS_SH} -uc 'foo=; echo $foo' >/dev/null || exit 2
|
||||
${THIS_SH} -uc 'foo=1; echo $foo' >/dev/null || exit 3
|
||||
# -/+/= are unaffected by set -u
|
||||
${THIS_SH} -uc 'unset foo; echo ${foo-}' >/dev/null || exit 4
|
||||
${THIS_SH} -uc 'unset foo; echo ${foo+}' >/dev/null || exit 5
|
||||
${THIS_SH} -uc 'unset foo; echo ${foo=}' >/dev/null || exit 6
|
||||
# length/trimming are affected
|
||||
${THIS_SH} -uc 'unset foo; echo ${#foo}' 2>/dev/null && exit 7
|
||||
${THIS_SH} -uc 'foo=; echo ${#foo}' >/dev/null || exit 8
|
||||
${THIS_SH} -uc 'unset foo; echo ${foo#?}' 2>/dev/null && exit 9
|
||||
${THIS_SH} -uc 'foo=1; echo ${foo#?}' >/dev/null || exit 10
|
||||
${THIS_SH} -uc 'unset foo; echo ${foo##?}' 2>/dev/null && exit 11
|
||||
${THIS_SH} -uc 'foo=1; echo ${foo##?}' >/dev/null || exit 12
|
||||
${THIS_SH} -uc 'unset foo; echo ${foo%?}' 2>/dev/null && exit 13
|
||||
${THIS_SH} -uc 'foo=1; echo ${foo%?}' >/dev/null || exit 14
|
||||
${THIS_SH} -uc 'unset foo; echo ${foo%%?}' 2>/dev/null && exit 15
|
||||
${THIS_SH} -uc 'foo=1; echo ${foo%%?}' >/dev/null || exit 16
|
||||
|
||||
${THIS_SH} -uc 'echo $!' 2>/dev/null && exit 17
|
||||
${THIS_SH} -uc ':& echo $!' >/dev/null || exit 18
|
||||
${THIS_SH} -uc 'echo $#' >/dev/null || exit 19
|
||||
${THIS_SH} -uc 'echo $1' 2>/dev/null && exit 20
|
||||
${THIS_SH} -uc 'echo $1' ${THIS_SH} x >/dev/null || exit 21
|
||||
${THIS_SH} -uc 'echo $2' ${THIS_SH} x 2>/dev/null && exit 22
|
||||
${THIS_SH} -uc 'echo $2' ${THIS_SH} x y >/dev/null || exit 23
|
||||
exit 0
|
||||
@@ -0,0 +1,40 @@
|
||||
1 }z
|
||||
2 ''z}
|
||||
3 foo 'bar baz
|
||||
4 foo b c baz
|
||||
5 foo b c baz
|
||||
6 }z
|
||||
7 }z
|
||||
8 ""z}
|
||||
9 "}"z
|
||||
10 foo bar} baz
|
||||
11 ''z}
|
||||
12 }z
|
||||
13 }z
|
||||
14 }z
|
||||
15 <foo abx{ {{{}b c d{} bar> <}> <baz> .
|
||||
16 hi there
|
||||
17 hi there
|
||||
18 hi there
|
||||
19 hi there
|
||||
20 hi there
|
||||
21 hi there
|
||||
22 hi there
|
||||
23 hi there
|
||||
24 'value'
|
||||
25 'value'
|
||||
26 $key
|
||||
27 'value'
|
||||
28 'x ~ x''x}"x}" #
|
||||
29 <foo> <abx{ {{> <{}b> <c> <d{}> <bar> <}> <baz> .
|
||||
30 <foo> <b\
|
||||
ar> <baz> .
|
||||
32 <foo> <bar> <baz> .
|
||||
33 <foo 'bar' baz> .
|
||||
34 <foo bar baz> .
|
||||
35 <a> <b> <x> <a> <b> .
|
||||
36 <a\ b> <x> <a\ b> .
|
||||
37 <a b> <x> <c d> .
|
||||
38 xay / x'a'y .
|
||||
39 x' / x' .
|
||||
40 < b c> .
|
||||
@@ -0,0 +1,21 @@
|
||||
|
||||
x=a\ b
|
||||
[ "$x" = "${x?}" ] || exit 1
|
||||
set -- ${x?}
|
||||
{ [ "$#" = 2 ] && [ "$1" = a ] && [ "$2" = b ]; } || exit 1
|
||||
unset x
|
||||
(echo ${x?abcdefg}) 2>&1 | grep -q abcdefg || exit 1
|
||||
${THIS_SH} -c 'unset foo; echo ${foo?}' 2>/dev/null && exit 2
|
||||
${THIS_SH} -c 'foo=; echo ${foo:?}' 2>/dev/null && exit 3
|
||||
${THIS_SH} -c 'foo=; echo ${foo?}' >/dev/null || exit 4
|
||||
${THIS_SH} -c 'foo=1; echo ${foo:?}' >/dev/null || exit 5
|
||||
${THIS_SH} -c 'echo ${!?}' 2>/dev/null && exit 6
|
||||
${THIS_SH} -c ':& echo ${!?}' >/dev/null || exit 7
|
||||
${THIS_SH} -c 'echo ${#?}' >/dev/null || exit 8
|
||||
${THIS_SH} -c 'echo ${*?}' 2>/dev/null && exit 9
|
||||
${THIS_SH} -c 'echo ${*?}' ${THIS_SH} x >/dev/null || exit 10
|
||||
${THIS_SH} -c 'echo ${1?}' 2>/dev/null && exit 11
|
||||
${THIS_SH} -c 'echo ${1?}' ${THIS_SH} x >/dev/null || exit 12
|
||||
${THIS_SH} -c 'echo ${2?}' ${THIS_SH} x 2>/dev/null && exit 13
|
||||
${THIS_SH} -c 'echo ${2?}' ${THIS_SH} x y >/dev/null || exit 14
|
||||
exit 0
|
||||
@@ -0,0 +1,47 @@
|
||||
# From mksh
|
||||
|
||||
set -o posix
|
||||
|
||||
(echo 1 ${IFS+'}'z}) 2>&- || echo failed in 1
|
||||
(echo 2 "${IFS+'}'z}") 2>&- || echo failed in 2
|
||||
(echo 3 "foo ${IFS+'bar} baz") 2>&- || echo failed in 3
|
||||
(echo -n '4 '; printf '%s\n' "foo ${IFS+"b c"} baz") 2>&- || echo failed in 4
|
||||
(echo -n '5 '; printf '%s\n' "foo ${IFS+b c} baz") 2>&- || echo failed in 5
|
||||
(echo 6 ${IFS+"}"z}) 2>&- || echo failed in 6
|
||||
(echo 7 "${IFS+"}"z}") 2>&- || echo failed in 7
|
||||
(echo 8 "${IFS+\"}\"z}") 2>&- || echo failed in 8
|
||||
(echo 9 "${IFS+\"\}\"z}") 2>&- || echo failed in 9
|
||||
(echo 10 foo ${IFS+'bar} baz'}) 2>&- || echo failed in 10
|
||||
(echo 11 "$(echo "${IFS+'}'z}")") 2>&- || echo failed in 11
|
||||
(echo 12 "$(echo ${IFS+'}'z})") 2>&- || echo failed in 12
|
||||
(echo 13 ${IFS+\}z}) 2>&- || echo failed in 13
|
||||
(echo 14 "${IFS+\}z}") 2>&- || echo failed in 14
|
||||
u=x; (echo -n '15 '; printf '<%s> ' "foo ${IFS+a"b$u{ {"{{\}b} c ${IFS+d{}} bar" ${IFS-e{}} baz; echo .) 2>&- || echo failed in 15
|
||||
l=t; (echo 16 ${IFS+h`echo -n i ${IFS+$l}h`ere}) 2>&- || echo failed in 16
|
||||
l=t; (echo 17 ${IFS+h$(echo -n i ${IFS+$l}h)ere}) 2>&- || echo failed in 17
|
||||
l=t; (echo 18 "${IFS+h`echo -n i ${IFS+$l}h`ere}") 2>&- || echo failed in 18
|
||||
l=t; (echo 19 "${IFS+h$(echo -n i ${IFS+$l}h)ere}") 2>&- || echo failed in 19
|
||||
l=t; (echo 20 ${IFS+h`echo -n i "${IFS+$l}"h`ere}) 2>&- || echo failed in 20
|
||||
l=t; (echo 21 ${IFS+h$(echo -n i "${IFS+$l}"h)ere}) 2>&- || echo failed in 21
|
||||
l=t; (echo 22 "${IFS+h`echo -n i "${IFS+$l}"h`ere}") 2>&- || echo failed in 22
|
||||
l=t; (echo 23 "${IFS+h$(echo -n i "${IFS+$l}"h)ere}") 2>&- || echo failed in 23
|
||||
key=value; (echo -n '24 '; printf '%s\n' "${IFS+'$key'}") 2>&- || echo failed in 24
|
||||
key=value; (echo -n '25 '; printf '%s\n' "${IFS+"'$key'"}") 2>&- || echo failed in 25 # ksh93: “'$key'”
|
||||
key=value; (echo -n '26 '; printf '%s\n' ${IFS+'$key'}) 2>&- || echo failed in 26
|
||||
key=value; (echo -n '27 '; printf '%s\n' ${IFS+"'$key'"}) 2>&- || echo failed in 27
|
||||
(echo -n '28 '; printf '%s\n' "${IFS+"'"x ~ x'}'x"'}"x}" #') 2>&- || echo failed in 28
|
||||
u=x; (echo -n '29 '; printf '<%s> ' foo ${IFS+a"b$u{ {"{ {\}b} c ${IFS+d{}} bar ${IFS-e{}} baz; echo .) 2>&- || echo failed in 29
|
||||
(echo -n '30 '; printf '<%s> ' ${IFS+foo 'b\
|
||||
ar' baz}; echo .) 2>&- || (echo failed in 30; echo failed in 31)
|
||||
(echo -n '32 '; printf '<%s> ' ${IFS+foo "b\
|
||||
ar" baz}; echo .) 2>&- || echo failed in 32
|
||||
(echo -n '33 '; printf '<%s> ' "${IFS+foo 'b\
|
||||
ar' baz}"; echo .) 2>&- || echo failed in 33
|
||||
(echo -n '34 '; printf '<%s> ' "${IFS+foo "b\
|
||||
ar" baz}"; echo .) 2>&- || echo failed in 34
|
||||
(echo -n '35 '; printf '<%s> ' ${v=a\ b} x ${v=c\ d}; echo .) 2>&- || echo failed in 35
|
||||
(echo -n '36 '; printf '<%s> ' "${v=a\ b}" x "${v=c\ d}"; echo .) 2>&- || echo failed in 36
|
||||
(echo -n '37 '; printf '<%s> ' ${v-a\ b} x ${v-c\ d}; echo .) 2>&- || echo failed in 37
|
||||
(echo 38 ${IFS+x'a'y} / "${IFS+x'a'y}" .) 2>&- || echo failed in 38
|
||||
foo="x'a'y"; (echo 39 ${foo%*'a'*} / "${foo%*'a'*}" .) 2>&- || echo failed in 39
|
||||
foo="a b c"; (echo -n '40 '; printf '<%s> ' "${foo#a}"; echo .) 2>&- || echo failed in 40
|
||||
@@ -0,0 +1,2 @@
|
||||
${THIS_SH} ./posixexp2.tests > /tmp/xx 2>&1
|
||||
diff /tmp/xx posixexp2.right && rm -f /tmp/xx
|
||||
@@ -0,0 +1,2 @@
|
||||
${THIS_SH} ./posixexp.tests > /tmp/xx 2>&1
|
||||
diff /tmp/xx posixexp.right && rm -f /tmp/xx
|
||||
Reference in New Issue
Block a user