mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-07-13 07:00:49 +02:00
commit bash-20180601 snapshot
This commit is contained in:
@@ -203,3 +203,23 @@ d
|
||||
e
|
||||
! !
|
||||
./histexp4.sub: line 20: !': event not found
|
||||
/tmp/Step1
|
||||
echo /$(echo tmp)/Step1
|
||||
/tmp/Step1
|
||||
echo /<(echo tmp)/Step1 > /dev/null
|
||||
/tmp/Step1
|
||||
echo $(echo /tmp)/Step1
|
||||
/tmp/Step1
|
||||
echo <(echo /tmp)/Step1 > /dev/null
|
||||
/+(one|two|three)/Step1
|
||||
echo /+(one|two|three)/Step1
|
||||
/+(one|two|three)/Step1
|
||||
/*(tmp|dev|usr)/Step1
|
||||
echo /*(tmp|dev|usr)/Step1
|
||||
/*(tmp|dev|usr)/Step1
|
||||
+(/one|/two|/three)/Step1
|
||||
echo +(/one|/two|/three)/Step1
|
||||
+(/one|/two|/three)/Step1
|
||||
*(/tmp|/dev|/usr)/Step1
|
||||
echo *(/tmp|/dev|/usr)/Step1
|
||||
*(/tmp|/dev|/usr)/Step1
|
||||
|
||||
@@ -140,3 +140,4 @@ ${THIS_SH} ./histexp1.sub
|
||||
${THIS_SH} ./histexp2.sub
|
||||
${THIS_SH} ./histexp3.sub
|
||||
${THIS_SH} ./histexp4.sub
|
||||
${THIS_SH} ./histexp5.sub
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
set -o history
|
||||
set -o histexpand
|
||||
|
||||
# command and process substitutions should be tokenized as a single word
|
||||
echo /$(echo tmp)/Step1
|
||||
echo !:*
|
||||
echo /<(echo tmp)/Step1 >/dev/null
|
||||
echo !:*
|
||||
|
||||
# same tests at the beginning of a word
|
||||
echo $(echo /tmp)/Step1
|
||||
echo !:*
|
||||
echo <(echo /tmp)/Step1 >/dev/null
|
||||
echo !:*
|
||||
|
||||
# so should shell extended glob patterns
|
||||
shopt -s extglob
|
||||
|
||||
echo /+(one|two|three)/Step1
|
||||
echo !:*
|
||||
echo /*(tmp|dev|usr)/Step1
|
||||
echo !:*
|
||||
|
||||
# same tests at the beginning of a word
|
||||
echo +(/one|/two|/three)/Step1
|
||||
echo !:*
|
||||
echo *(/tmp|/dev|/usr)/Step1
|
||||
echo !:*
|
||||
@@ -275,5 +275,9 @@ argv[2] = <b>
|
||||
[ abc def ghi jkl / abc def ghi jkl ]
|
||||
[ abc def ghi jkl ]
|
||||
[ abc def ghi jkl / abc def ghi jkl / abc def ghi jkl ]
|
||||
./posixexp.tests: line 82: unexpected EOF while looking for matching `}'
|
||||
./posixexp.tests: line 83: syntax error: unexpected end of file
|
||||
5: notOK
|
||||
OK
|
||||
OK
|
||||
5: $'not\ttoo\nbad'
|
||||
./posixexp.tests: line 83: unexpected EOF while looking for matching `}'
|
||||
./posixexp.tests: line 84: syntax error: unexpected end of file
|
||||
|
||||
@@ -76,6 +76,7 @@ ${THIS_SH} ./posixexp3.sub
|
||||
${THIS_SH} ./posixexp4.sub
|
||||
${THIS_SH} ./posixexp5.sub
|
||||
${THIS_SH} ./posixexp6.sub
|
||||
${THIS_SH} ./posixexp7.sub
|
||||
|
||||
# this will be an error
|
||||
foo=bar
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
# test the effect of quotes on the WORD in the posix pattern removal operators
|
||||
# a here document does not behave the same as double quotes
|
||||
x=notOK
|
||||
cat <<EOF
|
||||
5: ${x#$'not'}
|
||||
EOF
|
||||
|
||||
echo "${x#'not'}"
|
||||
echo "${x#$'not'}"
|
||||
|
||||
cat <<EOF
|
||||
5: $'not\ttoo\nbad'
|
||||
EOF
|
||||
@@ -145,8 +145,13 @@ outside:
|
||||
declare -x foo="abc"
|
||||
inside: declare -x var="value"
|
||||
outside: declare -- var="one"
|
||||
inside: declare -x var="value"
|
||||
outside: declare -x var="value"
|
||||
inside: declare -- var="local"
|
||||
outside: declare -x var="global"
|
||||
foo=<unset> environment foo=
|
||||
foo=foo environment foo=foo
|
||||
foo=foo environment foo=foo
|
||||
a=z
|
||||
a=b
|
||||
a=z
|
||||
|
||||
@@ -47,6 +47,28 @@ echo -n 'outside: ' ; declare -p var
|
||||
unset -v var
|
||||
unset -f func
|
||||
|
||||
# this will probably change behavior; export shouldn't behave like this when
|
||||
# not in posix mode and the sequencing is probably wrong in posix mode. since
|
||||
# export is a special builtin, the variable assignment should modify the
|
||||
# global variable, leaving the local variable unchanged. all shells, including
|
||||
# bash, modify the local variable; bash is the only one that propagates the
|
||||
# value out to the calling environment. bash does that only when in posix
|
||||
# mode.
|
||||
|
||||
func()
|
||||
{
|
||||
local var=inside
|
||||
var=value export var
|
||||
echo -n 'inside: ' ; declare -p var
|
||||
}
|
||||
|
||||
var=outside
|
||||
func
|
||||
echo -n 'outside: ' ; declare -p var
|
||||
|
||||
unset -v var
|
||||
unset -f func
|
||||
|
||||
func()
|
||||
{
|
||||
local var=local
|
||||
@@ -60,3 +82,19 @@ echo -n 'outside: ' ; declare -p var
|
||||
|
||||
unset -v var
|
||||
unset -f func
|
||||
|
||||
# test whether or not temporary environment assignments are exported
|
||||
# in posix mode
|
||||
showfoo()
|
||||
{
|
||||
printf %s "foo=${foo-<unset>}"
|
||||
echo -n ' environment foo='
|
||||
printenv foo || echo
|
||||
}
|
||||
unset foo
|
||||
showfoo
|
||||
foo=foo showfoo
|
||||
showfoo
|
||||
|
||||
unset -v foo
|
||||
unset -f showfoo
|
||||
|
||||
Reference in New Issue
Block a user