From: Chet Ramey Date: Fri, 14 Jun 2019 13:31:42 +0000 (-0400) Subject: commit bash-20190612 snapshot X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f60291079212f645650dca7d7bf6b067a9d96e97;p=thirdparty%2Fbash.git commit bash-20190612 snapshot --- diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index de1394d91..f3639b01b 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -6061,3 +6061,46 @@ execute_cmd.c conversion from a WORD_LIST into a string. This makes it more consistent with other arithmetic expansions. Inspired by a discussion begun by Nils Emmerich + + 6/10 + ---- +jobs.c + - waitchld: since process substitutions are asynchronous, save the + status of one that exits (that we still know about) in the bgpids + list + + 6/12 + ---- +jobs.c + - wait_for_background_pids: wait for the last procsub only if it's the + same as last_asynchronous_pid + +bashline.c + - bash_backward_shellword: changes to behave better when at the + beginning of the last character on the line and to leave point at + the beginning of the shellword, like backward-word. Fixes from + Andrew Gaylard + + 6/13 + ---- +bashline.c + - __P: Replaced with PARAMS. First of many + - bash_transpose_shellwords: transpose-words, but using `shellword' + word boundaries like shell-forward-word and shell-backward-word. + Contributed by Andrew Gaylard + - "shell-transpose-words": new name binding for bash_transpose_shellwords + - bash_readline_initialize: add default bindings for shell-forward-word, + shell-backward-word, shell-transpose-words, and shell-kill-word. + Suggested by Andrew Gaylard + +lib/readline/doc/rluser.texi + - shell-transpose-words: document + - {shell-forward-word,shell-backward-word,shell-kill-word,shell-transpose-words}: + document new default bindings bash now adds + +variables.c + - set_argv0: function to assign argv0 if it's found in the initial + shell environment. Suggested by Cuong Manh Le + + - initialize_shell_variables: call set_argv0() as part of shell + initialization diff --git a/bashline.c b/bashline.c index 87c5d146b..81bc214d4 100644 --- a/bashline.c +++ b/bashline.c @@ -102,121 +102,122 @@ #define RL_BOOLEAN_VARIABLE_VALUE(s) ((s)[0] == 'o' && (s)[1] == 'n' && (s)[2] == '\0') #if defined (BRACE_COMPLETION) -extern int bash_brace_completion __P((int, int)); +extern int bash_brace_completion PARAMS((int, int)); #endif /* BRACE_COMPLETION */ /* To avoid including curses.h/term.h/termcap.h and that whole mess. */ #ifdef _MINIX -extern int tputs __P((const char *string, int nlines, void (*outx)(int))); +extern int tputs PARAMS((const char *string, int nlines, void (*outx)(int))); #else -extern int tputs __P((const char *string, int nlines, int (*outx)(int))); +extern int tputs PARAMS((const char *string, int nlines, int (*outx)(int))); #endif /* Forward declarations */ /* Functions bound to keys in Readline for Bash users. */ -static int shell_expand_line __P((int, int)); -static int display_shell_version __P((int, int)); -static int operate_and_get_next __P((int, int)); +static int shell_expand_line PARAMS((int, int)); +static int display_shell_version PARAMS((int, int)); +static int operate_and_get_next PARAMS((int, int)); -static int bash_ignore_filenames __P((char **)); -static int bash_ignore_everything __P((char **)); -static int bash_progcomp_ignore_filenames __P((char **)); +static int bash_ignore_filenames PARAMS((char **)); +static int bash_ignore_everything PARAMS((char **)); +static int bash_progcomp_ignore_filenames PARAMS((char **)); #if defined (BANG_HISTORY) -static char *history_expand_line_internal __P((char *)); -static int history_expand_line __P((int, int)); -static int tcsh_magic_space __P((int, int)); +static char *history_expand_line_internal PARAMS((char *)); +static int history_expand_line PARAMS((int, int)); +static int tcsh_magic_space PARAMS((int, int)); #endif /* BANG_HISTORY */ #ifdef ALIAS -static int alias_expand_line __P((int, int)); +static int alias_expand_line PARAMS((int, int)); #endif #if defined (BANG_HISTORY) && defined (ALIAS) -static int history_and_alias_expand_line __P((int, int)); +static int history_and_alias_expand_line PARAMS((int, int)); #endif -static int bash_forward_shellword __P((int, int)); -static int bash_backward_shellword __P((int, int)); -static int bash_kill_shellword __P((int, int)); -static int bash_backward_kill_shellword __P((int, int)); +static int bash_forward_shellword PARAMS((int, int)); +static int bash_backward_shellword PARAMS((int, int)); +static int bash_kill_shellword PARAMS((int, int)); +static int bash_backward_kill_shellword PARAMS((int, int)); +static int bash_transpose_shellwords PARAMS((int, int)); /* Helper functions for Readline. */ -static char *restore_tilde __P((char *, char *)); -static char *maybe_restore_tilde __P((char *, char *)); +static char *restore_tilde PARAMS((char *, char *)); +static char *maybe_restore_tilde PARAMS((char *, char *)); -static char *bash_filename_rewrite_hook __P((char *, int)); +static char *bash_filename_rewrite_hook PARAMS((char *, int)); -static void bash_directory_expansion __P((char **)); -static int bash_filename_stat_hook __P((char **)); -static int bash_command_name_stat_hook __P((char **)); -static int bash_directory_completion_hook __P((char **)); -static int filename_completion_ignore __P((char **)); -static int bash_push_line __P((void)); +static void bash_directory_expansion PARAMS((char **)); +static int bash_filename_stat_hook PARAMS((char **)); +static int bash_command_name_stat_hook PARAMS((char **)); +static int bash_directory_completion_hook PARAMS((char **)); +static int filename_completion_ignore PARAMS((char **)); +static int bash_push_line PARAMS((void)); -static int executable_completion __P((const char *, int)); +static int executable_completion PARAMS((const char *, int)); -static rl_icppfunc_t *save_directory_hook __P((void)); -static void restore_directory_hook __P((rl_icppfunc_t)); +static rl_icppfunc_t *save_directory_hook PARAMS((void)); +static void restore_directory_hook PARAMS((rl_icppfunc_t)); -static int directory_exists __P((const char *, int)); +static int directory_exists PARAMS((const char *, int)); -static void cleanup_expansion_error __P((void)); -static void maybe_make_readline_line __P((char *)); -static void set_up_new_line __P((char *)); +static void cleanup_expansion_error PARAMS((void)); +static void maybe_make_readline_line PARAMS((char *)); +static void set_up_new_line PARAMS((char *)); -static int check_redir __P((int)); -static char **attempt_shell_completion __P((const char *, int, int)); -static char *variable_completion_function __P((const char *, int)); -static char *hostname_completion_function __P((const char *, int)); -static char *command_subst_completion_function __P((const char *, int)); +static int check_redir PARAMS((int)); +static char **attempt_shell_completion PARAMS((const char *, int, int)); +static char *variable_completion_function PARAMS((const char *, int)); +static char *hostname_completion_function PARAMS((const char *, int)); +static char *command_subst_completion_function PARAMS((const char *, int)); -static void build_history_completion_array __P((void)); -static char *history_completion_generator __P((const char *, int)); -static int dynamic_complete_history __P((int, int)); -static int bash_dabbrev_expand __P((int, int)); +static void build_history_completion_array PARAMS((void)); +static char *history_completion_generator PARAMS((const char *, int)); +static int dynamic_complete_history PARAMS((int, int)); +static int bash_dabbrev_expand PARAMS((int, int)); -static void initialize_hostname_list __P((void)); -static void add_host_name __P((char *)); -static void snarf_hosts_from_file __P((char *)); -static char **hostnames_matching __P((char *)); +static void initialize_hostname_list PARAMS((void)); +static void add_host_name PARAMS((char *)); +static void snarf_hosts_from_file PARAMS((char *)); +static char **hostnames_matching PARAMS((char *)); -static void _ignore_completion_names __P((char **, sh_ignore_func_t *)); -static int name_is_acceptable __P((const char *)); -static int test_for_directory __P((const char *)); -static int test_for_canon_directory __P((const char *)); -static int return_zero __P((const char *)); +static void _ignore_completion_names PARAMS((char **, sh_ignore_func_t *)); +static int name_is_acceptable PARAMS((const char *)); +static int test_for_directory PARAMS((const char *)); +static int test_for_canon_directory PARAMS((const char *)); +static int return_zero PARAMS((const char *)); -static char *bash_dequote_filename __P((char *, int)); -static char *quote_word_break_chars __P((char *)); -static void set_filename_bstab __P((const char *)); -static char *bash_quote_filename __P((char *, int, char *)); +static char *bash_dequote_filename PARAMS((char *, int)); +static char *quote_word_break_chars PARAMS((char *)); +static void set_filename_bstab PARAMS((const char *)); +static char *bash_quote_filename PARAMS((char *, int, char *)); #ifdef _MINIX -static void putx __P((int)); +static void putx PARAMS((int)); #else -static int putx __P((int)); +static int putx PARAMS((int)); #endif -static Keymap get_cmd_xmap_from_edit_mode __P((void)); -static Keymap get_cmd_xmap_from_keymap __P((Keymap)); +static Keymap get_cmd_xmap_from_edit_mode PARAMS((void)); +static Keymap get_cmd_xmap_from_keymap PARAMS((Keymap)); -static int bash_execute_unix_command __P((int, int)); -static void init_unix_command_map __P((void)); -static int isolate_sequence __P((char *, int, int, int *)); +static int bash_execute_unix_command PARAMS((int, int)); +static void init_unix_command_map PARAMS((void)); +static int isolate_sequence PARAMS((char *, int, int, int *)); -static int set_saved_history __P((void)); +static int set_saved_history PARAMS((void)); #if defined (ALIAS) -static int posix_edit_macros __P((int, int)); +static int posix_edit_macros PARAMS((int, int)); #endif -static int bash_event_hook __P((void)); +static int bash_event_hook PARAMS((void)); #if defined (PROGRAMMABLE_COMPLETION) -static int find_cmd_start __P((int)); -static int find_cmd_end __P((int)); -static char *find_cmd_name __P((int, int *, int *)); -static char *prog_complete_return __P((const char *, int)); +static int find_cmd_start PARAMS((int)); +static int find_cmd_end PARAMS((int)); +static char *find_cmd_name PARAMS((int, int *, int *)); +static char *prog_complete_return PARAMS((const char *, int)); static char **prog_complete_matches; #endif @@ -231,40 +232,40 @@ extern STRING_INT_ALIST word_token_alist[]; #define SPECIFIC_COMPLETION_FUNCTIONS #if defined (SPECIFIC_COMPLETION_FUNCTIONS) -static int bash_specific_completion __P((int, rl_compentry_func_t *)); - -static int bash_complete_filename_internal __P((int)); -static int bash_complete_username_internal __P((int)); -static int bash_complete_hostname_internal __P((int)); -static int bash_complete_variable_internal __P((int)); -static int bash_complete_command_internal __P((int)); - -static int bash_complete_filename __P((int, int)); -static int bash_possible_filename_completions __P((int, int)); -static int bash_complete_username __P((int, int)); -static int bash_possible_username_completions __P((int, int)); -static int bash_complete_hostname __P((int, int)); -static int bash_possible_hostname_completions __P((int, int)); -static int bash_complete_variable __P((int, int)); -static int bash_possible_variable_completions __P((int, int)); -static int bash_complete_command __P((int, int)); -static int bash_possible_command_completions __P((int, int)); - -static int completion_glob_pattern __P((char *)); -static char *glob_complete_word __P((const char *, int)); -static int bash_glob_completion_internal __P((int)); -static int bash_glob_complete_word __P((int, int)); -static int bash_glob_expand_word __P((int, int)); -static int bash_glob_list_expansions __P((int, int)); +static int bash_specific_completion PARAMS((int, rl_compentry_func_t *)); + +static int bash_complete_filename_internal PARAMS((int)); +static int bash_complete_username_internal PARAMS((int)); +static int bash_complete_hostname_internal PARAMS((int)); +static int bash_complete_variable_internal PARAMS((int)); +static int bash_complete_command_internal PARAMS((int)); + +static int bash_complete_filename PARAMS((int, int)); +static int bash_possible_filename_completions PARAMS((int, int)); +static int bash_complete_username PARAMS((int, int)); +static int bash_possible_username_completions PARAMS((int, int)); +static int bash_complete_hostname PARAMS((int, int)); +static int bash_possible_hostname_completions PARAMS((int, int)); +static int bash_complete_variable PARAMS((int, int)); +static int bash_possible_variable_completions PARAMS((int, int)); +static int bash_complete_command PARAMS((int, int)); +static int bash_possible_command_completions PARAMS((int, int)); + +static int completion_glob_pattern PARAMS((char *)); +static char *glob_complete_word PARAMS((const char *, int)); +static int bash_glob_completion_internal PARAMS((int)); +static int bash_glob_complete_word PARAMS((int, int)); +static int bash_glob_expand_word PARAMS((int, int)); +static int bash_glob_list_expansions PARAMS((int, int)); #endif /* SPECIFIC_COMPLETION_FUNCTIONS */ -static int edit_and_execute_command __P((int, int, int, char *)); +static int edit_and_execute_command PARAMS((int, int, int, char *)); #if defined (VI_MODE) -static int vi_edit_and_execute_command __P((int, int)); -static int bash_vi_complete __P((int, int)); +static int vi_edit_and_execute_command PARAMS((int, int)); +static int bash_vi_complete PARAMS((int, int)); #endif -static int emacs_edit_and_execute_command __P((int, int)); +static int emacs_edit_and_execute_command PARAMS((int, int)); /* Non-zero once initalize_readline () has been called. */ int bash_readline_initialized = 0; @@ -464,6 +465,7 @@ initialize_readline () rl_add_defun ("shell-backward-word", bash_backward_shellword, -1); rl_add_defun ("shell-kill-word", bash_kill_shellword, -1); rl_add_defun ("shell-backward-kill-word", bash_backward_kill_shellword, -1); + rl_add_defun ("shell-transpose-words", bash_transpose_shellwords, -1); #ifdef ALIAS rl_add_defun ("alias-expand-line", alias_expand_line, -1); @@ -616,6 +618,13 @@ initialize_readline () rl_filename_dequoting_function = bash_dequote_filename; rl_char_is_quoted_p = char_is_quoted; + /* Add some default bindings for the "shellwords" functions, roughly + parallelling the default word bindings in emacs mode. */ + rl_bind_key_if_unbound_in_map (CTRL('B'), bash_backward_shellword, emacs_meta_keymap); + rl_bind_key_if_unbound_in_map (CTRL('D'), bash_kill_shellword, emacs_meta_keymap); + rl_bind_key_if_unbound_in_map (CTRL('F'), bash_forward_shellword, emacs_meta_keymap); + rl_bind_key_if_unbound_in_map (CTRL('T'), bash_transpose_shellwords, emacs_meta_keymap); + #if 0 /* This is superfluous and makes it impossible to use tab completion in vi mode even when explicitly binding it in ~/.inputrc. sv_strict_posix() @@ -1197,7 +1206,7 @@ bash_backward_shellword (count, key) int count, key; { size_t slen; - int c, p; + int c, p, prev_p; DECLARE_MBSTATE; if (count < 0) @@ -1206,9 +1215,6 @@ bash_backward_shellword (count, key) p = rl_point; slen = rl_end; - if (p == rl_end && p > 0) - p--; - while (count) { if (p == 0) @@ -1217,7 +1223,10 @@ bash_backward_shellword (count, key) return 0; } - /* Move backward until we hit a non-metacharacter. */ + /* Move backward until we hit a non-metacharacter. We want to deal + with the characters before point, so we move off a word if we're + at its first character. */ + BACKUP_CHAR (rl_line_buffer, slen, p); while (p > 0) { c = rl_line_buffer[p]; @@ -1232,12 +1241,18 @@ bash_backward_shellword (count, key) return 0; } - /* Now move backward until we hit a metacharacter or BOL. */ + /* Now move backward until we hit a metacharacter or BOL. Leave point + at the start of the shellword or at BOL. */ + prev_p = p; while (p > 0) { c = rl_line_buffer[p]; if (WORDDELIM (c) && char_is_quoted (rl_line_buffer, p) == 0) - break; + { + p = prev_p; + break; + } + prev_p = p; BACKUP_CHAR (rl_line_buffer, slen, p); } @@ -1291,6 +1306,64 @@ bash_backward_kill_shellword (count, key) return 0; } +static int +bash_transpose_shellwords (count, key) + int count, key; +{ + char *word1, *word2; + int w1_beg, w1_end, w2_beg, w2_end; + int orig_point = rl_point; + + if (count == 0) + return 0; + + /* Find the two shell words. */ + bash_forward_shellword (count, key); + w2_end = rl_point; + bash_backward_shellword (1, key); + w2_beg = rl_point; + bash_backward_shellword (count, key); + w1_beg = rl_point; + bash_forward_shellword (1, key); + w1_end = rl_point; + + /* check that there really are two words. */ + if ((w1_beg == w2_beg) || (w2_beg < w1_end)) + { + rl_ding (); + rl_point = orig_point; + return 1; + } + + /* Get the text of the words. */ + word1 = rl_copy_text (w1_beg, w1_end); + word2 = rl_copy_text (w2_beg, w2_end); + + /* We are about to do many insertions and deletions. Remember them + as one operation. */ + rl_begin_undo_group (); + + /* Do the stuff at word2 first, so that we don't have to worry + about word1 moving. */ + rl_point = w2_beg; + rl_delete_text (w2_beg, w2_end); + rl_insert_text (word1); + + rl_point = w1_beg; + rl_delete_text (w1_beg, w1_end); + rl_insert_text (word2); + + /* This is exactly correct since the text before this point has not + changed in length. */ + rl_point = w2_end; + + /* I think that does it. */ + rl_end_undo_group (); + xfree (word1); + xfree (word2); + + return 0; +} /* **************************************************************** */ /* */ diff --git a/doc/bash.0 b/doc/bash.0 index 97265a763..3a78deffd 100644 --- a/doc/bash.0 +++ b/doc/bash.0 @@ -6041,21 +6041,22 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS Wait for each specified child process and return its termination status. Each _i_d may be a process ID or a job specification; if a job spec is given, all processes in that job's pipeline are - waited for. If _i_d is not given, all currently active child pro- - cesses are waited for, and the return status is zero. If the --nn - option is supplied, wwaaiitt waits for a single job to terminate and - returns its exit status. Supplying the --ff option, when job con- - trol is enabled, forces wwaaiitt to wait for _i_d to terminate before - returning its status, instead of returning when it changes sta- - tus. If _i_d specifies a non-existent process or job, the return - status is 127. Otherwise, the return status is the exit status - of the last process or job waited for. + waited for. If _i_d is not given, wwaaiitt waits for all running + background jobs and the last-executed process substitution, if + its process id is the same as $$!!, and the return status is zero. + If the --nn option is supplied, wwaaiitt waits for a single job to + terminate and returns its exit status. Supplying the --ff option, + when job control is enabled, forces wwaaiitt to wait for _i_d to ter- + minate before returning its status, instead of returning when it + changes status. If _i_d specifies a non-existent process or job, + the return status is 127. Otherwise, the return status is the + exit status of the last process or job waited for. RREESSTTRRIICCTTEEDD SSHHEELLLL If bbaasshh is started with the name rrbbaasshh, or the --rr option is supplied at - invocation, the shell becomes restricted. A restricted shell is used - to set up an environment more controlled than the standard shell. It - behaves identically to bbaasshh with the exception that the following are + invocation, the shell becomes restricted. A restricted shell is used + to set up an environment more controlled than the standard shell. It + behaves identically to bbaasshh with the exception that the following are disallowed or not performed: +o changing directories with ccdd @@ -6064,16 +6065,16 @@ RREESSTTRRIICCTTEEDD SSHHEELLLL +o specifying command names containing // - +o specifying a filename containing a // as an argument to the .. + +o specifying a filename 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 + +o importing function definitions from the shell environment at startup - +o parsing the value of SSHHEELLLLOOPPTTSS from the shell environment at + +o parsing the value of SSHHEELLLLOOPPTTSS from the shell environment at startup +o redirecting output using the >, >|, <>, >&, &>, and >> redirect- @@ -6082,10 +6083,10 @@ RREESSTTRRIICCTTEEDD SSHHEELLLL +o using the eexxeecc builtin command to replace the shell with another command - +o adding or deleting builtin commands with the --ff and --dd options + +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 @@ -6095,14 +6096,14 @@ RREESSTTRRIICCTTEEDD SSHHEELLLL These restrictions are enforced after any startup files are read. When a command that is found to be a shell script is executed (see CCOOMM-- - MMAANNDD EEXXEECCUUTTIIOONN above), rrbbaasshh turns off any restrictions in the shell + MMAANNDD EEXXEECCUUTTIIOONN above), rrbbaasshh turns off any restrictions in the shell spawned to execute the script. SSEEEE AALLSSOO _B_a_s_h _R_e_f_e_r_e_n_c_e _M_a_n_u_a_l, Brian Fox and Chet Ramey _T_h_e _G_n_u _R_e_a_d_l_i_n_e _L_i_b_r_a_r_y, Brian Fox and Chet Ramey _T_h_e _G_n_u _H_i_s_t_o_r_y _L_i_b_r_a_r_y, Brian Fox and Chet Ramey - _P_o_r_t_a_b_l_e _O_p_e_r_a_t_i_n_g _S_y_s_t_e_m _I_n_t_e_r_f_a_c_e _(_P_O_S_I_X_) _P_a_r_t _2_: _S_h_e_l_l _a_n_d _U_t_i_l_i_- + _P_o_r_t_a_b_l_e _O_p_e_r_a_t_i_n_g _S_y_s_t_e_m _I_n_t_e_r_f_a_c_e _(_P_O_S_I_X_) _P_a_r_t _2_: _S_h_e_l_l _a_n_d _U_t_i_l_i_- _t_i_e_s, IEEE -- http://pubs.opengroup.org/onlinepubs/9699919799/ http://tiswww.case.edu/~chet/bash/POSIX -- a description of posix mode @@ -6120,7 +6121,7 @@ FFIILLEESS _~_/_._b_a_s_h_r_c The individual per-interactive-shell startup file _~_/_._b_a_s_h___l_o_g_o_u_t - The individual login shell cleanup file, executed when a login + The individual login shell cleanup file, executed when a login shell exits _~_/_._i_n_p_u_t_r_c Individual _r_e_a_d_l_i_n_e initialization file @@ -6134,14 +6135,14 @@ AAUUTTHHOORRSS BBUUGG RREEPPOORRTTSS If you find a bug in bbaasshh,, you should report it. But first, you should - make sure that it really is a bug, and that it appears in the latest - version of bbaasshh. The latest version is always available from + make sure that it really is a bug, and that it appears in the latest + version of bbaasshh. The latest version is always available from _f_t_p_:_/_/_f_t_p_._g_n_u_._o_r_g_/_p_u_b_/_g_n_u_/_b_a_s_h_/. - Once you have determined that a bug actually exists, use the _b_a_s_h_b_u_g - command to submit a bug report. If you have a fix, you are encouraged - to mail that as well! Suggestions and `philosophical' bug reports may - be mailed to _b_u_g_-_b_a_s_h_@_g_n_u_._o_r_g or posted to the Usenet newsgroup + Once you have determined that a bug actually exists, use the _b_a_s_h_b_u_g + command to submit a bug report. If you have a fix, you are encouraged + to mail that as well! Suggestions and `philosophical' bug reports may + be mailed to _b_u_g_-_b_a_s_h_@_g_n_u_._o_r_g or posted to the Usenet newsgroup ggnnuu..bbaasshh..bbuugg. ALL bug reports should include: @@ -6152,7 +6153,7 @@ BBUUGG RREEPPOORRTTSS A description of the bug behaviour A short script or `recipe' which exercises the bug - _b_a_s_h_b_u_g inserts the first three items automatically into the template + _b_a_s_h_b_u_g inserts the first three items automatically into the template it provides for filing a bug report. Comments and bug reports concerning this manual page should be directed @@ -6169,10 +6170,10 @@ BBUUGGSS Shell builtin commands and functions are not stoppable/restartable. Compound commands and command sequences of the form `a ; b ; c' are not - handled gracefully when process suspension is attempted. When a - process is stopped, the shell immediately executes the next command in - the sequence. It suffices to place the sequence of commands between - parentheses to force it into a subshell, which may be stopped as a + handled gracefully when process suspension is attempted. When a + process is stopped, the shell immediately executes the next command in + the sequence. It suffices to place the sequence of commands between + parentheses to force it into a subshell, which may be stopped as a unit. Array variables may not (yet) be exported. diff --git a/doc/bash.1 b/doc/bash.1 index 1982f3832..b372c258b 100644 --- a/doc/bash.1 +++ b/doc/bash.1 @@ -10263,7 +10263,8 @@ Return a status of 0 (true) or 1 (false) depending on the evaluation of the conditional expression .IR expr . Each operator and operand must be a separate argument. -Expressions are composed of the primaries described above under +.if \n(zZ=0 Expressions are composed of the primaries described above under +.if \n(zZ=1 Expressions are composed of the primaries described in the \fBbash\fP manual page under .SM .BR "CONDITIONAL EXPRESSIONS" . \fBtest\fP does not accept any options, nor does it accept and ignore @@ -10775,8 +10776,11 @@ may be a process ID or a job specification; if a job spec is given, all processes in that job's pipeline are waited for. If .I id -is not given, all currently active child processes -are waited for, and the return status is zero. +is not given, +\fBwait\fP waits for all running background jobs and +the last-executed process substitution, if its process id is the same as +\fB$!\fP, +and the return status is zero. If the \fB\-n\fP option is supplied, \fBwait\fP waits for a single job to terminate and returns its exit status. Supplying the \fB\-f\fP option, when job control is enabled, diff --git a/doc/bash.html b/doc/bash.html index 41fccffc6..2483695c6 100644 --- a/doc/bash.html +++ b/doc/bash.html @@ -13658,8 +13658,11 @@ ID or a job specification; if a job spec is given, all processes in that job's pipeline are waited for. If id -is not given, all currently active child processes -are waited for, and the return status is zero. +is not given, +wait waits for all running background jobs and +the last-executed process substitution, if its process id is the same as +$!, +and the return status is zero. If the -n option is supplied, wait waits for a single job to terminate and returns its exit status. Supplying the -f option, when job control is enabled, @@ -14065,6 +14068,6 @@ There may be only one active coprocess at a time.
This document was created by man2html from bash.1.
-Time: 20 May 2019 14:36:28 EDT +Time: 12 June 2019 15:27:00 EDT diff --git a/doc/bash.info b/doc/bash.info index 4e5864b80..8c7359a45 100644 --- a/doc/bash.info +++ b/doc/bash.info @@ -2,9 +2,9 @@ This is bash.info, produced by makeinfo version 6.5 from bashref.texi. This text is a brief description of the features that are present in the -Bash shell (version 5.0, 20 May 2019). +Bash shell (version 5.0, 12 June 2019). - This is Edition 5.0, last updated 20 May 2019, of 'The GNU Bash + This is Edition 5.0, last updated 12 June 2019, of 'The GNU Bash Reference Manual', for 'Bash', Version 5.0. Copyright (C) 1988-2018 Free Software Foundation, Inc. @@ -27,10 +27,10 @@ Bash Features ************* This text is a brief description of the features that are present in the -Bash shell (version 5.0, 20 May 2019). The Bash home page is +Bash shell (version 5.0, 12 June 2019). The Bash home page is . - This is Edition 5.0, last updated 20 May 2019, of 'The GNU Bash + This is Edition 5.0, last updated 12 June 2019, of 'The GNU Bash Reference Manual', for 'Bash', Version 5.0. Bash contains features that appear in other popular shells, and some @@ -7019,15 +7019,16 @@ File: bash.info, Node: Job Control Builtins, Next: Job Control Variables, Pre Wait until the child process specified by each process ID PID or job specification JOBSPEC exits and return the exit status of the last command waited for. If a job spec is given, all processes in - the job are waited for. If no arguments are given, all currently - active child processes are waited for, and the return status is - zero. If the '-n' option is supplied, 'wait' waits for a single - job to terminate and returns its exit status. Supplying the '-f' - option, when job control is enabled, forces 'wait' to wait for each - PID or JOBSPEC to terminate before returning its status, intead of - returning when it changes status. If neither JOBSPEC nor PID - specifies an active child process of the shell, the return status - is 127. + the job are waited for. If no arguments are given, 'wait' waits + for all running background jobs and the last-executed process + substitution, if its process id is the same as $!, and the return + status is zero. If the '-n' option is supplied, 'wait' waits for a + single job to terminate and returns its exit status. Supplying the + '-f' option, when job control is enabled, forces 'wait' to wait for + each PID or JOBSPEC to terminate before returning its status, + intead of returning when it changes status. If neither JOBSPEC nor + PID specifies an active child process of the shell, the return + status is 127. 'disown' disown [-ar] [-h] [JOBSPEC ... | PID ... ] @@ -11012,7 +11013,7 @@ D.1 Index of Shell Builtin Commands * dirs: Directory Stack Builtins. (line 7) * disown: Job Control Builtins. - (line 92) + (line 93) * echo: Bash Builtins. (line 246) * enable: Bash Builtins. (line 295) * eval: Bourne Shell Builtins. @@ -11061,7 +11062,7 @@ D.1 Index of Shell Builtin Commands * shopt: The Shopt Builtin. (line 9) * source: Bash Builtins. (line 563) * suspend: Job Control Builtins. - (line 104) + (line 105) * test: Bourne Shell Builtins. (line 269) * times: Bourne Shell Builtins. @@ -11710,134 +11711,134 @@ D.5 Concept Index  Tag Table: -Node: Top887 -Node: Introduction2797 -Node: What is Bash?3013 -Node: What is a shell?4127 -Node: Definitions6665 -Node: Basic Shell Features9616 -Node: Shell Syntax10835 -Node: Shell Operation11861 -Node: Quoting13154 -Node: Escape Character14454 -Node: Single Quotes14939 -Node: Double Quotes15287 -Node: ANSI-C Quoting16565 -Node: Locale Translation17824 -Node: Comments18720 -Node: Shell Commands19338 -Node: Simple Commands20210 -Node: Pipelines20841 -Node: Lists23773 -Node: Compound Commands25564 -Node: Looping Constructs26576 -Node: Conditional Constructs29071 -Node: Command Grouping40239 -Node: Coprocesses41718 -Node: GNU Parallel43621 -Node: Shell Functions47679 -Node: Shell Parameters54762 -Node: Positional Parameters59175 -Node: Special Parameters60075 -Node: Shell Expansions63829 -Node: Brace Expansion65952 -Node: Tilde Expansion68675 -Node: Shell Parameter Expansion71292 -Node: Command Substitution85725 -Node: Arithmetic Expansion87080 -Node: Process Substitution88012 -Node: Word Splitting89132 -Node: Filename Expansion91076 -Node: Pattern Matching93606 -Node: Quote Removal97592 -Node: Redirections97887 -Node: Executing Commands107445 -Node: Simple Command Expansion108115 -Node: Command Search and Execution110045 -Node: Command Execution Environment112421 -Node: Environment115405 -Node: Exit Status117064 -Node: Signals118734 -Node: Shell Scripts120701 -Node: Shell Builtin Commands123216 -Node: Bourne Shell Builtins125254 -Node: Bash Builtins146004 -Node: Modifying Shell Behavior174929 -Node: The Set Builtin175274 -Node: The Shopt Builtin185687 -Node: Special Builtins203357 -Node: Shell Variables204336 -Node: Bourne Shell Variables204773 -Node: Bash Variables206877 -Node: Bash Features237824 -Node: Invoking Bash238723 -Node: Bash Startup Files244736 -Node: Interactive Shells249839 -Node: What is an Interactive Shell?250249 -Node: Is this Shell Interactive?250898 -Node: Interactive Shell Behavior251713 -Node: Bash Conditional Expressions255200 -Node: Shell Arithmetic259777 -Node: Aliases262594 -Node: Arrays265214 -Node: The Directory Stack270579 -Node: Directory Stack Builtins271363 -Node: Controlling the Prompt274331 -Node: The Restricted Shell277252 -Node: Bash POSIX Mode279734 -Node: Job Control290667 -Node: Job Control Basics291127 -Node: Job Control Builtins296091 -Node: Job Control Variables300831 -Node: Command Line Editing301987 -Node: Introduction and Notation303658 -Node: Readline Interaction305281 -Node: Readline Bare Essentials306472 -Node: Readline Movement Commands308255 -Node: Readline Killing Commands309215 -Node: Readline Arguments311133 -Node: Searching312177 -Node: Readline Init File314363 -Node: Readline Init File Syntax315622 -Node: Conditional Init Constructs336061 -Node: Sample Init File340257 -Node: Bindable Readline Commands343374 -Node: Commands For Moving344578 -Node: Commands For History346427 -Node: Commands For Text350722 -Node: Commands For Killing354110 -Node: Numeric Arguments356591 -Node: Commands For Completion357730 -Node: Keyboard Macros361921 -Node: Miscellaneous Commands362608 -Node: Readline vi Mode368561 -Node: Programmable Completion369468 -Node: Programmable Completion Builtins377248 -Node: A Programmable Completion Example387943 -Node: Using History Interactively393190 -Node: Bash History Facilities393874 -Node: Bash History Builtins396879 -Node: History Interaction401410 -Node: Event Designators405030 -Node: Word Designators406249 -Node: Modifiers407886 -Node: Installing Bash409288 -Node: Basic Installation410425 -Node: Compilers and Options413683 -Node: Compiling For Multiple Architectures414424 -Node: Installation Names416117 -Node: Specifying the System Type416935 -Node: Sharing Defaults417651 -Node: Operation Controls418324 -Node: Optional Features419282 -Node: Reporting Bugs429800 -Node: Major Differences From The Bourne Shell430994 -Node: GNU Free Documentation License447846 -Node: Indexes473023 -Node: Builtin Index473477 -Node: Reserved Word Index480304 -Node: Variable Index482752 -Node: Function Index498576 -Node: Concept Index511879 +Node: Top889 +Node: Introduction2801 +Node: What is Bash?3017 +Node: What is a shell?4131 +Node: Definitions6669 +Node: Basic Shell Features9620 +Node: Shell Syntax10839 +Node: Shell Operation11865 +Node: Quoting13158 +Node: Escape Character14458 +Node: Single Quotes14943 +Node: Double Quotes15291 +Node: ANSI-C Quoting16569 +Node: Locale Translation17828 +Node: Comments18724 +Node: Shell Commands19342 +Node: Simple Commands20214 +Node: Pipelines20845 +Node: Lists23777 +Node: Compound Commands25568 +Node: Looping Constructs26580 +Node: Conditional Constructs29075 +Node: Command Grouping40243 +Node: Coprocesses41722 +Node: GNU Parallel43625 +Node: Shell Functions47683 +Node: Shell Parameters54766 +Node: Positional Parameters59179 +Node: Special Parameters60079 +Node: Shell Expansions63833 +Node: Brace Expansion65956 +Node: Tilde Expansion68679 +Node: Shell Parameter Expansion71296 +Node: Command Substitution85729 +Node: Arithmetic Expansion87084 +Node: Process Substitution88016 +Node: Word Splitting89136 +Node: Filename Expansion91080 +Node: Pattern Matching93610 +Node: Quote Removal97596 +Node: Redirections97891 +Node: Executing Commands107449 +Node: Simple Command Expansion108119 +Node: Command Search and Execution110049 +Node: Command Execution Environment112425 +Node: Environment115409 +Node: Exit Status117068 +Node: Signals118738 +Node: Shell Scripts120705 +Node: Shell Builtin Commands123220 +Node: Bourne Shell Builtins125258 +Node: Bash Builtins146008 +Node: Modifying Shell Behavior174933 +Node: The Set Builtin175278 +Node: The Shopt Builtin185691 +Node: Special Builtins203361 +Node: Shell Variables204340 +Node: Bourne Shell Variables204777 +Node: Bash Variables206881 +Node: Bash Features237828 +Node: Invoking Bash238727 +Node: Bash Startup Files244740 +Node: Interactive Shells249843 +Node: What is an Interactive Shell?250253 +Node: Is this Shell Interactive?250902 +Node: Interactive Shell Behavior251717 +Node: Bash Conditional Expressions255204 +Node: Shell Arithmetic259781 +Node: Aliases262598 +Node: Arrays265218 +Node: The Directory Stack270583 +Node: Directory Stack Builtins271367 +Node: Controlling the Prompt274335 +Node: The Restricted Shell277256 +Node: Bash POSIX Mode279738 +Node: Job Control290671 +Node: Job Control Basics291131 +Node: Job Control Builtins296095 +Node: Job Control Variables300913 +Node: Command Line Editing302069 +Node: Introduction and Notation303740 +Node: Readline Interaction305363 +Node: Readline Bare Essentials306554 +Node: Readline Movement Commands308337 +Node: Readline Killing Commands309297 +Node: Readline Arguments311215 +Node: Searching312259 +Node: Readline Init File314445 +Node: Readline Init File Syntax315704 +Node: Conditional Init Constructs336143 +Node: Sample Init File340339 +Node: Bindable Readline Commands343456 +Node: Commands For Moving344660 +Node: Commands For History346509 +Node: Commands For Text350804 +Node: Commands For Killing354192 +Node: Numeric Arguments356673 +Node: Commands For Completion357812 +Node: Keyboard Macros362003 +Node: Miscellaneous Commands362690 +Node: Readline vi Mode368643 +Node: Programmable Completion369550 +Node: Programmable Completion Builtins377330 +Node: A Programmable Completion Example388025 +Node: Using History Interactively393272 +Node: Bash History Facilities393956 +Node: Bash History Builtins396961 +Node: History Interaction401492 +Node: Event Designators405112 +Node: Word Designators406331 +Node: Modifiers407968 +Node: Installing Bash409370 +Node: Basic Installation410507 +Node: Compilers and Options413765 +Node: Compiling For Multiple Architectures414506 +Node: Installation Names416199 +Node: Specifying the System Type417017 +Node: Sharing Defaults417733 +Node: Operation Controls418406 +Node: Optional Features419364 +Node: Reporting Bugs429882 +Node: Major Differences From The Bourne Shell431076 +Node: GNU Free Documentation License447928 +Node: Indexes473105 +Node: Builtin Index473559 +Node: Reserved Word Index480386 +Node: Variable Index482834 +Node: Function Index498658 +Node: Concept Index511961  End Tag Table diff --git a/doc/bash.pdf b/doc/bash.pdf index fc89651b7..7da0ffbd9 100644 Binary files a/doc/bash.pdf and b/doc/bash.pdf differ diff --git a/doc/bash.ps b/doc/bash.ps index 4f0a22c47..ca7890741 100644 --- a/doc/bash.ps +++ b/doc/bash.ps @@ -1,6 +1,6 @@ %!PS-Adobe-3.0 %%Creator: groff version 1.22.3 -%%CreationDate: Mon May 20 14:36:19 2019 +%%CreationDate: Wed Jun 12 15:26:50 2019 %%DocumentNeededResources: font Times-Roman %%+ font Times-Bold %%+ font Times-Italic @@ -9587,23 +9587,24 @@ tion status.).8 F(Each)5.659 E F2(id)3.169 E F0 .659(may be a process) 3.929 F .009(ID or a job speci\214cation; if a job spec is gi)144 636 R -.15(ve)-.25 G .008(n, all processes in that job').15 F 2.508(sp)-.55 G .008(ipeline are w)-2.508 F .008(aited for)-.1 F 5.008(.I)-.55 G(f) --5.008 E F2(id)144.01 648 Q F0 .521(is not gi)3.791 F -.15(ve)-.25 G -.521(n, all currently acti).15 F .821 -.15(ve c)-.25 H .521 -(hild processes are w).15 F .521(aited for)-.1 F 3.021(,a)-.4 G .521 -(nd the return status is zero.)-3.021 F(If)5.522 E(the)144 660 Q F1 -2.948 E F0 .448(option is supplied,)2.948 F F1(wait)2.948 E F0 -.1 -(wa)2.948 G .448(its for a single job to terminate and returns its e).1 -F .447(xit status.)-.15 F(Sup-)5.447 E 1.023(plying the)144 672 R F1 -3.523 E F0 1.023(option, when job control is enabled, forces)3.523 -F F1(wait)3.524 E F0 1.024(to w)3.524 F 1.024(ait for)-.1 F F2(id)3.524 -E F0 1.024(to terminate before)3.524 F 1.835 -(returning its status, instead of returning when it changes status.)144 -684 R(If)6.835 E F2(id)4.345 E F0 1.835(speci\214es a non-e)5.105 F -(xistent)-.15 E 1.022(process or job, the return status is 127.)144 696 -R 1.023(Otherwise, the return status is the e)6.023 F 1.023 -(xit status of the last)-.15 F(process or job w)144 708 Q(aited for)-.1 -E(.)-.55 E(GNU Bash 5.0)72 768 Q(2019 May 20)148.175 E(79)197.335 E 0 Cg -EP +-5.008 E F2(id)144.01 648 Q F0 .441(is not gi)3.711 F -.15(ve)-.25 G(n,) +.15 E F1(wait)2.941 E F0 -.1(wa)2.941 G .441 +(its for all running background jobs and the last-e).1 F -.15(xe)-.15 G +.442(cuted process substitu-).15 F .598 +(tion, if its process id is the same as)144 660 R F1($!)3.098 E F0 3.098 +(,a)C .598(nd the return status is zero.)-3.098 F .597(If the)5.597 F F1 +3.097 E F0 .597(option is supplied,)3.097 F F1(wait)144 672 Q F0 +-.1(wa)3.056 G .556(its for a single job to terminate and returns its e) +.1 F .557(xit status.)-.15 F .557(Supplying the)5.557 F F13.057 E +F0 .557(option, when)3.057 F .346(job control is enabled, forces)144 684 +R F1(wait)2.846 E F0 .346(to w)2.846 F .346(ait for)-.1 F F2(id)2.846 E +F0 .346(to terminate before returning its status, instead of)2.846 F +.599(returning when it changes status.)144 696 R(If)5.599 E F2(id)3.109 +E F0 .599(speci\214es a non-e)3.869 F .6 +(xistent process or job, the return status is)-.15 F 2.5 +(127. Otherwise,)144 708 R(the return status is the e)2.5 E +(xit status of the last process or job w)-.15 E(aited for)-.1 E(.)-.55 E +(GNU Bash 5.0)72 768 Q(2019 May 20)148.175 E(79)197.335 E 0 Cg EP %%Page: 80 80 %%BeginPageSetup BP diff --git a/doc/bashref.dvi b/doc/bashref.dvi index f56d9909c..cbff87ec9 100644 Binary files a/doc/bashref.dvi and b/doc/bashref.dvi differ diff --git a/doc/bashref.html b/doc/bashref.html index e27a22f40..5cf724cd4 100644 --- a/doc/bashref.html +++ b/doc/bashref.html @@ -1,9 +1,9 @@