Bash-5.3-alpha release

This commit is contained in:
Chet Ramey
2024-04-22 10:33:38 -04:00
parent f3b6bd1945
commit 622d318652
700 changed files with 136534 additions and 96420 deletions
+40 -9
View File
@@ -11,13 +11,19 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Filter stdin to remove builtin array variables that are
# automatically set and possibly contain values that vary.
ignore_builtin_arrays()
{
grep -v -e BASH_VERSINFO= -e PIPESTATUS= -e GROUPS=
}
# this is needed so that the bad assignments (b[]=bcde, for example) do not
# cause fatal shell errors when in posix mode
set +o posix
set +a
# The calls to egrep -v are to filter out builtin array variables that are
# automatically set and possibly contain values that vary.
# first make sure we handle the basics
x=()
@@ -61,7 +67,7 @@ echo ${a[@]}
echo ${a[*]}
# this should print out values, too
declare -a | egrep -v '(BASH_VERSINFO|PIPESTATUS|GROUPS)'
declare -a | ignore_builtin_arrays
unset a[7]
echo ${a[*]}
@@ -92,11 +98,11 @@ echo ${a[@]}
readonly a[5]
readonly a
# these two lines should output `declare' commands
readonly -a | egrep -v '(BASH_VERSINFO|PIPESTATUS|GROUPS)'
declare -ar | egrep -v '(BASH_VERSINFO|PIPESTATUS|GROUPS)'
readonly -a | ignore_builtin_arrays
declare -ar | ignore_builtin_arrays
# this line should output `readonly' commands, even for arrays
set -o posix
readonly -a | egrep -v '(BASH_VERSINFO|PIPESTATUS|GROUPS)'
readonly -a | ignore_builtin_arrays
set +o posix
declare -a d='([1]="" [2]="bdef" [5]="hello world" "test")'
@@ -111,7 +117,7 @@ b=([0]=this [1]=is [2]=a [3]=test [4]="$PS1" [5]=$pass)
echo ${b[@]:2:3}
declare -pa | egrep -v '(BASH_VERSINFO|PIPESTATUS|GROUPS)'
declare -pa | ignore_builtin_arrays
a[3]="this is a test"
@@ -125,11 +131,13 @@ echo ${c[-4]}
d[7]=(abdedfegeee)
d=([]=abcde [1]="test test" [*]=last [-65]=negative )
d=([0]=abcde [1]="test test" [*]=last )
d=([1]="test test" [-65]=negative )
unset d[12]
unset e[*]
declare -a | egrep -v '(BASH_VERSINFO|PIPESTATUS|GROUPS)'
declare -a | ignore_builtin_arrays
ps1='hello'
unset ps1[2]
@@ -155,7 +163,7 @@ echo ${vv[0]} ${vv[3]}
echo ${vv[@]}
unset vv
declare -a | egrep -v '(BASH_VERSINFO|PIPESTATUS|GROUPS)'
declare -a | ignore_builtin_arrays
export rv
#set
@@ -226,6 +234,11 @@ unset xpath[nelem-1]
nelem=${#xpath[@]}
echo ${#xpath[@]} -- $nelem
# error
echo ${#xpath[-10]}
# zero length for unset elements
echo ${#xpath[42]}
# arrays and things that look like index assignments
array=(42 [1]=14 [2]=44)
@@ -250,6 +263,9 @@ barray=(new1 new2 new3)
echo "length = ${#barray[@]}"
echo "value = ${barray[*]}"
# the compound assignment syntax inherited from ksh93 has some quirks
badarray=( metacharacters like & need to be quoted in compound assignments)
# make sure the array code behaves correctly with respect to unset variables
set -u
( echo ${#narray[4]} )
@@ -397,6 +413,18 @@ Z='a b'
A=( X=$Z )
declare -p A
# combine with brace expansion
letters=( {0..9} )
echo "${letters["{2..6}"]}"
# tests for assigning to noassign array variables
BASH_ARGC=(xxx) ; echo FIN1:$?
BASH_ARGC=foio ; echo FIN2:$?
declare BASH_ARGC=(xxx) ; echo FIN3:$?
declare BASH_ARGC=foio ; echo FIN4:$?
BASH_ARGV[1]=foo ; echo FIN5:$?
declare BASH_ARGV[1]=foo ; echo FIN6:$?
# tests for bash-3.1 problems
${THIS_SH} ./array5.sub
@@ -427,3 +455,6 @@ ${THIS_SH} ./array27.sub
${THIS_SH} ./array28.sub
${THIS_SH} ./array29.sub
${THIS_SH} ./array30.sub
${THIS_SH} ./array31.sub
${THIS_SH} ./array32.sub
${THIS_SH} ./array33.sub