mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-08-03 16:59:22 +02:00
commit bash-20100701 snapshot
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
after 1: foo = a b c
|
||||
after 2: tot = 6
|
||||
after: 7
|
||||
last = c
|
||||
1 -- 142 1
|
||||
0 -- 0 1 0
|
||||
1 -- 0 0 1
|
||||
1 -- 0 0 1
|
||||
1 -- 0 1 0
|
||||
lastpipe1.sub returns 14
|
||||
@@ -0,0 +1,38 @@
|
||||
shopt -s lastpipe
|
||||
|
||||
unset foo bar
|
||||
echo a b c | read foo
|
||||
echo after 1: foo = $foo
|
||||
|
||||
unset tot
|
||||
declare -i tot
|
||||
printf "%d\n" 1 2 3 | while read foo; do tot+=$foo; done
|
||||
echo after 2: tot = $tot
|
||||
|
||||
unset bar
|
||||
echo g h i | bar=7
|
||||
echo after: $bar
|
||||
|
||||
unset foo last
|
||||
printf "%s\n" a b c | while read foo; do last=$foo; done
|
||||
echo last = $last
|
||||
|
||||
exit 142 | false
|
||||
echo $? -- ${PIPESTATUS[@]}
|
||||
|
||||
true | false | /usr/bin/true
|
||||
echo $? -- ${PIPESTATUS[@]}
|
||||
|
||||
true | /usr/bin/true | false
|
||||
echo $? -- ${PIPESTATUS[@]}
|
||||
|
||||
set -o pipefail
|
||||
true | /usr/bin/true | false
|
||||
echo $? -- ${PIPESTATUS[@]}
|
||||
|
||||
true | /usr/bin/false | true
|
||||
echo $? -- ${PIPESTATUS[@]}
|
||||
set +o pipefail
|
||||
|
||||
${THIS_SH} ./lastpipe1.sub
|
||||
echo lastpipe1.sub returns $?
|
||||
@@ -0,0 +1,37 @@
|
||||
shopt -s lastpipe
|
||||
|
||||
unset foo bar
|
||||
echo a b c | read foo
|
||||
echo after 1: foo = $foo
|
||||
|
||||
unset tot
|
||||
declare -i tot
|
||||
printf "%d\n" 1 2 3 | while read foo; do tot+=$foo; done
|
||||
echo after 2: tot = $tot
|
||||
|
||||
unset bar
|
||||
echo g h i | bar=7
|
||||
echo after: $bar
|
||||
|
||||
unset foo last
|
||||
printf "%s\n" a b c | while read foo; do last=$foo; done
|
||||
echo last = $last
|
||||
|
||||
exit 142 | false
|
||||
echo $? -- ${PIPESTATUS[@]}
|
||||
|
||||
true | false | /usr/bin/true
|
||||
echo $? -- ${PIPESTATUS[@]}
|
||||
|
||||
true | /usr/bin/true | false
|
||||
echo $? -- ${PIPESTATUS[@]}
|
||||
|
||||
set -o pipefail
|
||||
true | /usr/bin/true | false
|
||||
echo $? -- ${PIPESTATUS[@]}
|
||||
|
||||
true | /usr/bin/false | true
|
||||
echo $? -- ${PIPESTATUS[@]}
|
||||
set +o pipefail
|
||||
|
||||
${THIS_SH} ./lastpipe1.sub
|
||||
@@ -0,0 +1,5 @@
|
||||
# with lastpipe set, exit at the end of a pipeline exits
|
||||
# the calling shell
|
||||
shopt -s lastpipe
|
||||
exit 142 | exit 14
|
||||
echo after: $?
|
||||
@@ -0,0 +1,4 @@
|
||||
# with lastpipe set, exit at the end of a pipeline exits
|
||||
# the calling shell
|
||||
exit 142 | exit 14
|
||||
echo after: $?
|
||||
@@ -0,0 +1,2 @@
|
||||
${THIS_SH} ./lastpipe.tests > /tmp/xx 2>&1
|
||||
diff /tmp/xx lastpipe.right && rm -f /tmp/xx
|
||||
@@ -0,0 +1,6 @@
|
||||
echo "warning: UNIX versions number signals and schedule processes differently." >&2
|
||||
echo "warning: If output differing only in line numbers is produced, please" >&2
|
||||
echo "warning: do not consider this a test failure." >&2
|
||||
|
||||
${THIS_SH} ./trap.tests > /tmp/xx 2>&1
|
||||
diff /tmp/xx trap.right && rm -f /tmp/xx
|
||||
@@ -29,6 +29,7 @@ shopt -u histverify
|
||||
shopt -s hostcomplete
|
||||
shopt -u huponexit
|
||||
shopt -s interactive_comments
|
||||
shopt -u lastpipe
|
||||
shopt -u lithist
|
||||
shopt -u login_shell
|
||||
shopt -u mailwarn
|
||||
@@ -79,6 +80,7 @@ shopt -u histappend
|
||||
shopt -u histreedit
|
||||
shopt -u histverify
|
||||
shopt -u huponexit
|
||||
shopt -u lastpipe
|
||||
shopt -u lithist
|
||||
shopt -u login_shell
|
||||
shopt -u mailwarn
|
||||
@@ -111,6 +113,7 @@ histappend off
|
||||
histreedit off
|
||||
histverify off
|
||||
huponexit off
|
||||
lastpipe off
|
||||
lithist off
|
||||
login_shell off
|
||||
mailwarn off
|
||||
|
||||
Reference in New Issue
Block a user