mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-07-11 06:00:49 +02:00
commit bash-20141024 snapshot
This commit is contained in:
+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
|
||||
|
||||
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
BUILD_DIR=/usr/local/build/chet/bash/bash-current
|
||||
THIS_SH=$BUILD_DIR/bash
|
||||
PATH=$PATH:$BUILD_DIR
|
||||
|
||||
export THIS_SH PATH
|
||||
|
||||
rm -f /tmp/xx
|
||||
|
||||
/bin/sh "$@"
|
||||
@@ -214,8 +214,8 @@ ${THIS_SH} ./dollar-at-star1.sub
|
||||
# more tests for expanding $@ and $* in a context where there is no word
|
||||
# splitting
|
||||
${THIS_SH} ./dollar-at-star2.sub
|
||||
|
||||
${THIS_SH} ./dollar-at-star3.sub
|
||||
${THIS_SH} ./dollar-at-star4.sub
|
||||
|
||||
# tests for special expansion of "$*" and "${array[*]}" when used with other
|
||||
# expansions -- bugs through bash-2.05b
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
# tests for quoted and unquoted, split and unsplit expansions of $@ and $*
|
||||
# Posix interpretation 221 speaks to this issue
|
||||
|
||||
set -- a b
|
||||
IFS=
|
||||
x=abc
|
||||
|
||||
printf "<%s>\n" ${x#$*}
|
||||
|
||||
a="a bc"
|
||||
echo ${a#$*}
|
||||
unset x a
|
||||
|
||||
a=$@
|
||||
echo "$a"
|
||||
|
||||
a=$*
|
||||
echo "$a"
|
||||
|
||||
printf '<%s>' $@ ; echo
|
||||
|
||||
IFS='
|
||||
'
|
||||
|
||||
a=$@
|
||||
echo "$a"
|
||||
|
||||
a=$*
|
||||
echo "$a"
|
||||
|
||||
unset a
|
||||
|
||||
unset IFS
|
||||
set a b "c d"
|
||||
printf '<%s>' $* ; echo
|
||||
|
||||
IFS=
|
||||
set a b "c d"
|
||||
printf '<%s>' $* ; echo
|
||||
|
||||
IFS=:
|
||||
set a b
|
||||
printf '<%s>' ${foo=$*} ; echo
|
||||
printf '<%s>' "${foo}" ; echo
|
||||
|
||||
unset foo
|
||||
IFS='
|
||||
'
|
||||
printf '<%s>' ${foo=$@} ; echo
|
||||
printf '<%s>' "$foo" ; echo
|
||||
|
||||
IFS=?
|
||||
set a c
|
||||
foo=abcd
|
||||
|
||||
echo ${foo#"$*"}
|
||||
echo "${foo#$*}"
|
||||
|
||||
echo "${foo#'a?c'}"
|
||||
echo "${foo#a?c}"
|
||||
|
||||
IFS=?
|
||||
set a c
|
||||
str=a$'\001'c
|
||||
pat=a$'\001'
|
||||
echo "${str#$pat}"
|
||||
|
||||
set a b
|
||||
IFS=:
|
||||
|
||||
a=$@
|
||||
recho "$a"
|
||||
|
||||
recho ${foo=$*}
|
||||
recho "$foo"
|
||||
|
||||
unset foo
|
||||
IFS='
|
||||
'
|
||||
recho ${foo=$@}
|
||||
recho "$foo"
|
||||
|
||||
shift $#
|
||||
unset foo
|
||||
@@ -0,0 +1,81 @@
|
||||
# tests for quoted and unquoted, split and unsplit expansions of $@ and $*
|
||||
# Posix interpretation 221 speaks to this issue
|
||||
|
||||
set -- a b
|
||||
IFS=
|
||||
x=abc
|
||||
|
||||
printf "<%s>\n" ${x#$*}
|
||||
|
||||
a="a bc"
|
||||
echo ${a#$*}
|
||||
unset x a
|
||||
|
||||
a=$@
|
||||
echo "$a"
|
||||
|
||||
a=$*
|
||||
echo "$a"
|
||||
|
||||
printf '<%s>' $@ ; echo
|
||||
|
||||
IFS='
|
||||
'
|
||||
|
||||
a=$@
|
||||
echo "$a"
|
||||
|
||||
a=$*
|
||||
echo "$a"
|
||||
|
||||
unset a
|
||||
|
||||
unset IFS
|
||||
set a b "c d"
|
||||
printf '<%s>' $* ; echo
|
||||
|
||||
IFS=
|
||||
set a b "c d"
|
||||
printf '<%s>' $* ; echo
|
||||
|
||||
IFS=:
|
||||
set a b
|
||||
printf '<%s>' ${foo=$*} ; echo
|
||||
printf '<%s>' "${foo}" ; echo
|
||||
|
||||
unset foo
|
||||
IFS='
|
||||
'
|
||||
printf '<%s>' ${foo=$@} ; echo
|
||||
printf '<%s>' "$foo" ; echo
|
||||
|
||||
IFS=?
|
||||
set a c
|
||||
foo=abcd
|
||||
|
||||
echo ${foo#"$*"}
|
||||
echo "${foo#$*}"
|
||||
|
||||
echo "${foo#'a?c'}"
|
||||
echo "${foo#a?c}"
|
||||
|
||||
IFS=?
|
||||
set a c
|
||||
str=a$'\001'c
|
||||
pat=a$'\001'
|
||||
echo "${str#$pat}"
|
||||
|
||||
set a b
|
||||
IFS=:
|
||||
|
||||
a=$@
|
||||
recho "$a"
|
||||
|
||||
recho ${foo=$*}
|
||||
recho "$foo"
|
||||
|
||||
unset foo
|
||||
IFS='
|
||||
'
|
||||
recho ${foo=$@}
|
||||
recho "$foo"
|
||||
Executable
+266
@@ -0,0 +1,266 @@
|
||||
# first, let's start with the basics
|
||||
|
||||
recho "$@"
|
||||
recho "$*"
|
||||
|
||||
recho $@
|
||||
recho $*
|
||||
|
||||
set a b
|
||||
|
||||
recho "$*"
|
||||
|
||||
# If IFS is null, the parameters are joined without separators
|
||||
IFS=''
|
||||
recho "$*"
|
||||
|
||||
# If IFS is unset, the parameters are separated by spaces
|
||||
unset IFS
|
||||
recho "${*}"
|
||||
|
||||
recho "$@"
|
||||
recho $@
|
||||
|
||||
IFS='/'
|
||||
set bob 'tom dick harry' joe
|
||||
set $*
|
||||
recho $#
|
||||
recho $1
|
||||
recho $2
|
||||
recho $3
|
||||
|
||||
set bob 'tom dick harry' joe
|
||||
set ${*}
|
||||
recho $#
|
||||
recho $1
|
||||
recho $2
|
||||
recho $3
|
||||
|
||||
set bob 'tom dick harry' joe
|
||||
set $@
|
||||
recho $#
|
||||
recho $1
|
||||
recho $2
|
||||
recho $3
|
||||
|
||||
set bob 'tom dick harry' joe
|
||||
set ${@}
|
||||
recho $#
|
||||
recho $1
|
||||
recho $2
|
||||
recho $3
|
||||
|
||||
# according to POSIX.2, unquoted $* should expand to multiple words if
|
||||
# $IFS is null, just like unquoted $@
|
||||
IFS=''
|
||||
set bob 'tom dick harry' joe
|
||||
set $*
|
||||
recho $#
|
||||
recho $1
|
||||
recho $2
|
||||
recho $3
|
||||
|
||||
set bob 'tom dick harry' joe
|
||||
set $@
|
||||
recho $#
|
||||
recho $1
|
||||
recho $2
|
||||
recho $3
|
||||
|
||||
# if IFS is unset, the individual positional parameters are split on
|
||||
# " \t\n" if $* or $@ are unquoted
|
||||
unset IFS
|
||||
set bob 'tom dick harry' joe
|
||||
set $*
|
||||
recho $#
|
||||
recho $1
|
||||
recho $2
|
||||
recho $3
|
||||
|
||||
set bob 'tom dick harry' joe
|
||||
set $@
|
||||
recho $#
|
||||
recho $1
|
||||
recho $2
|
||||
recho $3
|
||||
|
||||
# but not for "$@" or "$*"
|
||||
set bob 'tom dick harry' joe
|
||||
set "$*"
|
||||
recho $#
|
||||
recho $1
|
||||
recho $2
|
||||
recho $3
|
||||
|
||||
set bob 'tom dick harry' joe
|
||||
set "$@"
|
||||
recho $#
|
||||
recho $1
|
||||
recho $2
|
||||
recho $3
|
||||
|
||||
# POSIX.2 says these should both expand the positional parameters
|
||||
# to multiple words
|
||||
set a b c d e
|
||||
IFS=""
|
||||
recho $@
|
||||
recho "$@"
|
||||
|
||||
# this example is straight from the POSIX.2 rationale
|
||||
set foo bar bam
|
||||
|
||||
recho "$@"
|
||||
recho "$*"
|
||||
|
||||
unset IFS
|
||||
|
||||
recho "$@"
|
||||
recho $@
|
||||
recho "$*"
|
||||
|
||||
IFS=:
|
||||
|
||||
# special variables
|
||||
set -- 1 2 3 4 5 6 7 8 9 10
|
||||
|
||||
bar=${*}
|
||||
foo=$*
|
||||
echo foo = "$foo"
|
||||
echo bar = "$bar"
|
||||
|
||||
foo1=$@
|
||||
bar1=${@}
|
||||
|
||||
echo foo1 = "$foo1"
|
||||
echo bar1 = "$bar1"
|
||||
|
||||
foo2="$*"
|
||||
bar2="${*}"
|
||||
|
||||
echo foo2 = "$foo2"
|
||||
echo bar2 = "$bar2"
|
||||
|
||||
eval foo3='$*' bar3='${*}'
|
||||
echo foo3 = "$foo3"
|
||||
echo bar3 = "$bar3"
|
||||
|
||||
case $* in
|
||||
*\:*) echo ok 1;;
|
||||
*) echo bad 1;;
|
||||
esac
|
||||
|
||||
case $@ in
|
||||
*\:*) echo bad 2;;
|
||||
*) echo ok 2;;
|
||||
esac
|
||||
|
||||
case "$*" in
|
||||
*\:*) echo ok 3;;
|
||||
*) echo bad 3;;
|
||||
esac
|
||||
|
||||
case "$@" in
|
||||
*\:*) echo bad 4;;
|
||||
*) echo ok 4;;
|
||||
esac
|
||||
|
||||
IFS=$' \t\n'
|
||||
|
||||
bar=${*}
|
||||
foo=$*
|
||||
echo foo = "$foo"
|
||||
echo bar = "$bar"
|
||||
|
||||
foo1=$@
|
||||
bar1=${@}
|
||||
|
||||
echo foo1 = "$foo1"
|
||||
echo bar1 = "$bar1"
|
||||
|
||||
foo2="$*"
|
||||
bar2="${*}"
|
||||
|
||||
echo foo2 = "$foo2"
|
||||
echo bar2 = "$bar2"
|
||||
|
||||
eval foo3='$*' bar3='${*}'
|
||||
echo foo3 = "$foo3"
|
||||
echo bar3 = "$bar3"
|
||||
|
||||
case $* in
|
||||
*\ *) echo ok 1;;
|
||||
*) echo bad 1;;
|
||||
esac
|
||||
|
||||
case $@ in
|
||||
*\ *) echo ok 2;;
|
||||
*) echo bad 2;;
|
||||
esac
|
||||
|
||||
case "$*" in
|
||||
*\ *) echo ok 3;;
|
||||
*) echo bad 3;;
|
||||
esac
|
||||
|
||||
case "$@" in
|
||||
*\ *) echo ok 4;;
|
||||
*) echo bad 4;;
|
||||
esac
|
||||
|
||||
# tests for the effect of quoting $* and $@ in an assignment context (plus
|
||||
# arrays) -- bugs through bash 4.2
|
||||
${THIS_SH} ./dollar-at-star1.sub
|
||||
|
||||
# more tests for expanding $@ and $* in a context where there is no word
|
||||
# splitting
|
||||
${THIS_SH} ./dollar-at-star2.sub
|
||||
|
||||
${THIS_SH} ./dollar-at-star3.sub
|
||||
|
||||
# tests for special expansion of "$*" and "${array[*]}" when used with other
|
||||
# expansions -- bugs through bash-2.05b
|
||||
${THIS_SH} ./dollar-star1.sub
|
||||
|
||||
# tests for expansion of "$@" on rhs of things like ${param:+word}. Bugs
|
||||
# though bash-2.05b
|
||||
${THIS_SH} ./dollar-at1.sub
|
||||
|
||||
# tests for expansion of other variables in double-quoted strings containing
|
||||
# $@. Bugs through bash-2.05b
|
||||
${THIS_SH} ./dollar-at2.sub
|
||||
|
||||
# tests for various expansions of $* in different contexts -- word split,
|
||||
# no splitting, etc. when $IFS is NUL
|
||||
${THIS_SH} ./dollar-star2.sub
|
||||
|
||||
# tests for expansions of "${array[*]}" and "${array[@]}" when $IFS is not the
|
||||
# default and the array contains null elements
|
||||
${THIS_SH} ./dollar-star3.sub
|
||||
|
||||
# test for set -u and expansions of $@ when there are no positional parameters
|
||||
${THIS_SH} ./dollar-at3.sub
|
||||
# test for set -u and expansions of $* when there are no positional parameters
|
||||
${THIS_SH} ./dollar-star4.sub
|
||||
|
||||
# tests for expansions of $* when IFS is null
|
||||
${THIS_SH} ./dollar-star5.sub
|
||||
|
||||
# tests for inappropriate word splitting through bash-4.2
|
||||
${THIS_SH} ./dollar-at4.sub
|
||||
|
||||
# tests for problems with "$@" preceded and followed by other quoted expansions
|
||||
# through bash-4.2
|
||||
${THIS_SH} ./dollar-at5.sub
|
||||
|
||||
# tests for problems with "${@:1}" and other expansions with null entries
|
||||
# in positional parameters
|
||||
${THIS_SH} ./dollar-at6.sub
|
||||
|
||||
# tests for expansions of $* when $1 == ""; problem through bash-4.2
|
||||
${THIS_SH} ./dollar-star6.sub
|
||||
|
||||
# tests for expansions of $* (unquoted) when IFS changes (e.g., ${IFS:=-})
|
||||
# problem through bash-4.2
|
||||
${THIS_SH} ./dollar-star7.sub
|
||||
|
||||
exit 0
|
||||
@@ -161,6 +161,30 @@ argv[1] = <a>
|
||||
argv[1] = <one>
|
||||
<123 abc> <def> <ghi 456>
|
||||
<123 abc> <def> <ghi\ 456>
|
||||
<c>
|
||||
a bc
|
||||
a b
|
||||
ab
|
||||
<a><b>
|
||||
a b
|
||||
a b
|
||||
<a><b><c><d>
|
||||
<a><b><c d>
|
||||
<a><b>
|
||||
<a:b>
|
||||
<a><b>
|
||||
<a b>
|
||||
abcd
|
||||
d
|
||||
abcd
|
||||
d
|
||||
c
|
||||
argv[1] = <a b>
|
||||
argv[1] = <abcd>
|
||||
argv[1] = <abcd>
|
||||
argv[1] = <a>
|
||||
argv[2] = <b>
|
||||
argv[1] = <a b>
|
||||
xa|xb|xc
|
||||
xa|xb|xc
|
||||
a|b|c
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
:; ./shx
|
||||
|
||||
sh:
|
||||
<&$fd ok
|
||||
nlbq Mon Aug 3 02:45:00 EDT 1992
|
||||
bang geoff
|
||||
quote 712824302
|
||||
setbq defmsgid=<1992Aug3.024502.6176@host>
|
||||
bgwait sleep done... wait 6187
|
||||
|
||||
|
||||
bash:
|
||||
<&$fd ok
|
||||
nlbq Mon Aug 3 02:45:09 EDT 1992
|
||||
bang geoff
|
||||
quote 712824311
|
||||
setbq defmsgid=<1992Aug3.024512.6212@host>
|
||||
bgwait sleep done... wait 6223
|
||||
|
||||
|
||||
ash:
|
||||
<&$fd shx1: 4: Syntax error: Bad fd number
|
||||
nlbq Mon Aug 3 02:45:19 EDT 1992
|
||||
bang geoff
|
||||
quote getdate: `"now"' not a valid date
|
||||
|
||||
setbq defmsgid=<1992Aug3.` echo 024521
|
||||
bgwait sleep done... wait 6241
|
||||
|
||||
|
||||
ksh:
|
||||
<&$fd ok
|
||||
nlbq ./shx: 6248 Memory fault - core dumped
|
||||
bang geoff
|
||||
quote getdate: `"now"' not a valid date
|
||||
|
||||
setbq defmsgid=<1992Aug3.024530.6257@host>
|
||||
bgwait no such job: 6265
|
||||
wait 6265
|
||||
sleep done...
|
||||
|
||||
zsh:
|
||||
<&$fd ok
|
||||
nlbq Mon Aug 3 02:45:36 EDT 1992
|
||||
bang shx3: event not found: /s/ [4]
|
||||
quote 712824337
|
||||
setbq defmsgid=<..6290@host>
|
||||
bgwait shx7: unmatched " [9]
|
||||
sleep done...
|
||||
:;
|
||||
@@ -0,0 +1,10 @@
|
||||
#! /bin/sh
|
||||
for cmd in sh bash ash ksh zsh
|
||||
do
|
||||
echo
|
||||
echo $cmd:
|
||||
for demo in shx?
|
||||
do
|
||||
$cmd $demo
|
||||
done
|
||||
done
|
||||
Reference in New Issue
Block a user