commit bash-20140606 snapshot

This commit is contained in:
Chet Ramey
2014-06-23 14:58:17 -04:00
parent dcebf63480
commit bbea163ce4
14 changed files with 2895 additions and 29 deletions
+28 -26
View File
@@ -673,25 +673,27 @@ PPAARRAAMMEETTEERRSS
the ddeeccllaarree or llooccaall builtin commands (see the descriptions of ddeeccllaarree
and llooccaall below) to create a _n_a_m_e_r_e_f, or a reference to another vari-
able. This allows variables to be manipulated indirectly. Whenever
the nameref variable is referenced or assigned to, the operation is
actually performed on the variable specified by the nameref variable's
value. A nameref is commonly used within shell functions to refer to a
variable whose name is passed as an argument to the function. For
instance, if a variable name is passed to a shell function as its first
argument, running
declare -n ref=$1
inside the function creates a nameref variable rreeff whose value is the
variable name passed as the first argument. References and assignments
to rreeff are treated as references and assignments to the variable whose
name was passed as $$11. If the control variable in a ffoorr loop has the
nameref attribute, the list of words can be a list of shell variables,
and a name reference will be established for each word in the list, in
turn, when the loop is executed. Array variables cannot be given the
--nn attribute. However, nameref variables can reference array variables
and subscripted array variables. Namerefs can be unset using the --nn
option to the uunnsseett builtin. Otherwise, if uunnsseett is executed with the
name of a nameref variable as an argument, the variable referenced by
the nameref variable will be unset.
the nameref variable is referenced, assigned to, unset, or has its
attributes modified (other than the _n_a_m_e_r_e_f_P _a_t_t_r_i_b_u_t_e _i_t_s_e_l_f_)_, _t_h_e
_o_p_e_r_a_t_i_o_n _i_s _a_c_t_u_a_l_l_y _p_e_r_f_o_r_m_e_d _o_n _t_h_e _v_a_r_i_a_b_l_e _s_p_e_c_i_f_i_e_d _b_y _t_h_e
_n_a_m_e_r_e_f _v_a_r_i_a_b_l_e_'_s _v_a_l_u_e_. _A _n_a_m_e_r_e_f _i_s _c_o_m_m_o_n_l_y _u_s_e_d _w_i_t_h_i_n _s_h_e_l_l
_f_u_n_c_t_i_o_n_s _t_o _r_e_f_e_r _t_o _a _v_a_r_i_a_b_l_e _w_h_o_s_e _n_a_m_e _i_s _p_a_s_s_e_d _a_s _a_n _a_r_g_u_m_e_n_t _t_o
_t_h_e _f_u_n_c_t_i_o_n_. _F_o_r _i_n_s_t_a_n_c_e_, _i_f _a _v_a_r_i_a_b_l_e _n_a_m_e _i_s _p_a_s_s_e_d _t_o _a _s_h_e_l_l
_f_u_n_c_t_i_o_n _a_s _i_t_s _f_i_r_s_t _a_r_g_u_m_e_n_t_, _r_u_n_n_i_n_g
_d_e_c_l_a_r_e _-_n _r_e_f_=_$_1
_i_n_s_i_d_e _t_h_e _f_u_n_c_t_i_o_n _c_r_e_a_t_e_s _a _n_a_m_e_r_e_f _v_a_r_i_a_b_l_e rreeff _w_h_o_s_e _v_a_l_u_e _i_s _t_h_e
_v_a_r_i_a_b_l_e _n_a_m_e _p_a_s_s_e_d _a_s _t_h_e _f_i_r_s_t _a_r_g_u_m_e_n_t_. _R_e_f_e_r_e_n_c_e_s _a_n_d _a_s_s_i_g_n_m_e_n_t_s
_t_o rreeff_, _a_n_d _c_h_a_n_g_e_s _t_o _i_t_s _a_t_t_r_i_b_u_t_e_s_, _a_r_e _t_r_e_a_t_e_d _a_s _r_e_f_e_r_e_n_c_e_s_,
_a_s_s_i_g_n_m_e_n_t_s_, _a_n_d _a_t_t_r_i_b_u_t_e _m_o_d_i_f_i_c_a_t_i_o_n_s _t_o _t_h_e _v_a_r_i_a_b_l_e _w_h_o_s_e _n_a_m_e _w_a_s
_p_a_s_s_e_d _a_s $$11_. _I_f _t_h_e _c_o_n_t_r_o_l _v_a_r_i_a_b_l_e _i_n _a ffoorr _l_o_o_p _h_a_s _t_h_e _n_a_m_e_r_e_f
_a_t_t_r_i_b_u_t_e_, _t_h_e _l_i_s_t _o_f _w_o_r_d_s _c_a_n _b_e _a _l_i_s_t _o_f _s_h_e_l_l _v_a_r_i_a_b_l_e_s_, _a_n_d _a
_n_a_m_e _r_e_f_e_r_e_n_c_e _w_i_l_l _b_e _e_s_t_a_b_l_i_s_h_e_d _f_o_r _e_a_c_h _w_o_r_d _i_n _t_h_e _l_i_s_t_, _i_n _t_u_r_n_,
_w_h_e_n _t_h_e _l_o_o_p _i_s _e_x_e_c_u_t_e_d_. _A_r_r_a_y _v_a_r_i_a_b_l_e_s _c_a_n_n_o_t _b_e _g_i_v_e_n _t_h_e 00mmeerreeff
_a_t_t_r_i_b_u_t_e_. _H_o_w_e_v_e_r_, _n_a_m_e_r_e_f _v_a_r_i_a_b_l_e_s _c_a_n _r_e_f_e_r_e_n_c_e _a_r_r_a_y _v_a_r_i_a_b_l_e_s
_a_n_d _s_u_b_s_c_r_i_p_t_e_d _a_r_r_a_y _v_a_r_i_a_b_l_e_s_. _N_a_m_e_r_e_f_s _c_a_n _b_e _u_n_s_e_t _u_s_i_n_g _t_h_e --nn
_o_p_t_i_o_n _t_o _t_h_e uunnsseett _b_u_i_l_t_i_n_. _O_t_h_e_r_w_i_s_e_, _i_f uunnsseett _i_s _e_x_e_c_u_t_e_d _w_i_t_h _t_h_e
_n_a_m_e _o_f _a _n_a_m_e_r_e_f _v_a_r_i_a_b_l_e _a_s _a_n _a_r_g_u_m_e_n_t_, _t_h_e _v_a_r_i_a_b_l_e _r_e_f_e_r_e_n_c_e_d _b_y
_t_h_e _n_a_m_e_r_e_f _v_a_r_i_a_b_l_e _w_i_l_l _b_e _u_n_s_e_t_.
PPoossiittiioonnaall PPaarraammeetteerrss
A _p_o_s_i_t_i_o_n_a_l _p_a_r_a_m_e_t_e_r is a parameter denoted by one or more digits,
@@ -3939,7 +3941,7 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
bbiinndd [--mm _k_e_y_m_a_p] --ff _f_i_l_e_n_a_m_e
bbiinndd [--mm _k_e_y_m_a_p] --xx _k_e_y_s_e_q:_s_h_e_l_l_-_c_o_m_m_a_n_d
bbiinndd [--mm _k_e_y_m_a_p] _k_e_y_s_e_q:_f_u_n_c_t_i_o_n_-_n_a_m_e
bbiinndd _r_e_a_d_l_i_n_e_-_c_o_m_m_a_n_d
bbiinndd [--mm _k_e_y_m_a_p] _k_e_y_s_e_q:_r_e_a_d_l_i_n_e_-_c_o_m_m_a_n_d
Display current rreeaaddlliinnee key and function bindings, bind a key
sequence to a rreeaaddlliinnee function or macro, or set a rreeaaddlliinnee
variable. Each non-option argument is a command as it would
@@ -4274,11 +4276,11 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
attribute is disabled.
--nn Give each _n_a_m_e the _n_a_m_e_r_e_f attribute, making it a name
reference to another variable. That other variable is
defined by the value of _n_a_m_e. All references and assign-
ments to _n_a_m_e, except for changing the --nn attribute
itself, are performed on the variable referenced by
_n_a_m_e's value. The --nn attribute cannot be applied to
array variables.
defined by the value of _n_a_m_e. All references, assign-
ments, and attribute modifications to _n_a_m_e, except for
changing the --nn attribute itself, are performed on the
variable referenced by _n_a_m_e's value. The nameref
attribute cannot be applied to array variables.
--rr Make _n_a_m_es readonly. These names cannot then be assigned
values by subsequent assignment statements or unset.
--tt Give each _n_a_m_e the _t_r_a_c_e attribute. Traced functions
@@ -5734,4 +5736,4 @@ BBUUGGSS
GNU Bash 4.3 2014 March 18 BASH(1)
GNU Bash 4.3 2014 May 12 BASH(1)