mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-07-05 11:20:50 +02:00
readline fix for do-lowercase-version; fix for reading here-documents from aliases
This commit is contained in:
+7
-1
@@ -153,8 +153,14 @@ HERE
|
||||
echo 3 4;
|
||||
done
|
||||
}
|
||||
hello
|
||||
world
|
||||
hello
|
||||
world
|
||||
here-document
|
||||
here-document
|
||||
comsub here-string
|
||||
./heredoc.tests: line 181: warning: here-document at line 178 delimited by end-of-file (wanted `')
|
||||
./heredoc.tests: line 184: warning: here-document at line 181 delimited by end-of-file (wanted `')
|
||||
hi
|
||||
there
|
||||
''
|
||||
|
||||
@@ -168,6 +168,9 @@ ${THIS_SH} ./heredoc8.sub
|
||||
# various tests for printing here-documents in function bodies
|
||||
${THIS_SH} ./heredoc9.sub
|
||||
|
||||
# test various combinations of here-documents and aliases
|
||||
${THIS_SH} ./heredoc10.sub
|
||||
|
||||
echo $(
|
||||
cat <<< "comsub here-string"
|
||||
)
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
# test various forms of reading here-documents from an alias
|
||||
shopt -s expand_aliases
|
||||
|
||||
# single alias definition contains entire here-document
|
||||
alias 'foo=cat <<EOF
|
||||
hello
|
||||
world
|
||||
EOF'
|
||||
foo
|
||||
|
||||
# here-document body continues after alias definition
|
||||
alias 'foo=cat <<EOF
|
||||
hello'
|
||||
foo
|
||||
world
|
||||
EOF
|
||||
|
||||
# here-document delimiter in one alias, body in another
|
||||
shopt -s expand_aliases
|
||||
alias c='cat <<\END' d='c
|
||||
here-document
|
||||
END'
|
||||
d
|
||||
|
||||
# make sure delimiter is recognized whether the alias ends with a newline or not
|
||||
shopt -s expand_aliases
|
||||
alias c='cat <<\END' d='c
|
||||
here-document
|
||||
END
|
||||
'
|
||||
d
|
||||
@@ -38,6 +38,9 @@ abcde
|
||||
30
|
||||
40
|
||||
50
|
||||
declare -x var="60"
|
||||
outside
|
||||
assignment
|
||||
|0|10|
|
||||
10
|
||||
|0|10|
|
||||
@@ -159,6 +162,8 @@ inside func: var=two
|
||||
outside 2.1: var=global
|
||||
inside func1: var=value
|
||||
outside 3.0: var=value
|
||||
inside func1: var=func
|
||||
outside 3.5: var=outside
|
||||
inside func2: var=global
|
||||
outside 4.0: var=outside
|
||||
foo: hello world
|
||||
|
||||
@@ -39,3 +39,26 @@ var=40 func
|
||||
|
||||
echo expect 50
|
||||
var=50 command printenv var
|
||||
|
||||
# this behaves the same in bash and posix mode
|
||||
export -n var # make sure it's not exported
|
||||
echo expect 60
|
||||
var=60 export var
|
||||
declare -p var
|
||||
|
||||
# this behaves differently in bash and posix mode: `.' is a special builtin
|
||||
unset -v var
|
||||
var=outside
|
||||
echo 'var=assignment' >$TMPFILE
|
||||
|
||||
echo expect outside
|
||||
var=temp . $TMPFILE
|
||||
echo $var
|
||||
|
||||
set -o posix
|
||||
echo expect assignment
|
||||
var=temp . $TMPFILE
|
||||
echo $var
|
||||
|
||||
rm -f $TMPFILE
|
||||
unset -v var
|
||||
|
||||
@@ -134,6 +134,19 @@ echo -n 'outside 3.0: ' ; echo "var=${var-<unset>}"
|
||||
unset -v var
|
||||
unset -f func1
|
||||
|
||||
# operations inside a function on temporary variables do not propagate
|
||||
func1()
|
||||
{
|
||||
export var
|
||||
echo -n 'inside func1: ' ; echo "var=${var-<unset>}"
|
||||
}
|
||||
var=outside
|
||||
var=func func1
|
||||
echo -n 'outside 3.5: ' ; echo "var=${var-<unset>}"
|
||||
|
||||
unset -v var
|
||||
unset -f func1
|
||||
|
||||
func2()
|
||||
{
|
||||
local var=local
|
||||
|
||||
Reference in New Issue
Block a user