mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-08-09 03:30:48 +02:00
commit bash-20041122 snapshot
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
BUILD_DIR=/usr/local/build/bash/bash-current
|
||||
THIS_SH=ksh93
|
||||
PATH=$PATH:$BUILD_DIR
|
||||
|
||||
export THIS_SH PATH
|
||||
|
||||
rm -f /tmp/xx
|
||||
|
||||
/bin/sh "$@"
|
||||
@@ -96,3 +96,7 @@ after read
|
||||
0
|
||||
before block
|
||||
after block
|
||||
c1 is 1
|
||||
c2 is 2
|
||||
c3 is 3
|
||||
c4 is 4
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
abc
|
||||
./redir.tests: line 13: /tmp/redir-test: cannot overwrite existing file
|
||||
abc
|
||||
def
|
||||
def
|
||||
./redir.tests: line 29: $z: ambiguous redirect
|
||||
Point 1
|
||||
Point 2
|
||||
to a
|
||||
to b
|
||||
Point 3
|
||||
to a
|
||||
to a
|
||||
to b
|
||||
to b
|
||||
Point 4
|
||||
to c
|
||||
Point 5
|
||||
this is redir1.sub
|
||||
this is redir2.sub
|
||||
read line1 "ab"
|
||||
read line2 "root"
|
||||
read line3 "cd"
|
||||
read line4 "daemon"
|
||||
from stdin: aa
|
||||
to stdout
|
||||
./redir4.sub: line 32: $fd: ambiguous redirect
|
||||
./redir4.sub: line 33: $fd: ambiguous redirect
|
||||
/tmp/err-and-out:
|
||||
to stdout
|
||||
to stderr
|
||||
/tmp/err-and-out:
|
||||
to stdout
|
||||
to stderr
|
||||
0 -- 3 0
|
||||
0 -- 4 0
|
||||
ab
|
||||
cd
|
||||
ef
|
||||
gh
|
||||
ij
|
||||
kl
|
||||
0
|
||||
ab
|
||||
cd
|
||||
cd
|
||||
./redir.tests: line 152: redir1.*: No such file or directory
|
||||
# tests of ksh93-like dup-and-close redirection operators
|
||||
exec 9<$0
|
||||
|
||||
f()
|
||||
{
|
||||
exec 5<$0
|
||||
|
||||
exec 0<&5-
|
||||
|
||||
while read line; do
|
||||
echo "$line"
|
||||
done
|
||||
}
|
||||
|
||||
f
|
||||
|
||||
typeset -f f
|
||||
|
||||
# make sure it was closed
|
||||
read -u 5 foo
|
||||
echo after read
|
||||
|
||||
exec 5<&0
|
||||
|
||||
exec <&-
|
||||
|
||||
read abcde
|
||||
|
||||
exec 0<&9-
|
||||
read line
|
||||
echo $line
|
||||
f ()
|
||||
{
|
||||
exec 5<$0;
|
||||
exec 0<&5-;
|
||||
while read line; do
|
||||
echo "$line";
|
||||
done
|
||||
}
|
||||
./redir5.sub: line 20: read: 5: invalid file descriptor: Bad file descriptor
|
||||
after read
|
||||
./redir5.sub: line 27: read: read error: 0: Bad file descriptor
|
||||
# tests of ksh93-like dup-and-close redirection operators
|
||||
/
|
||||
/
|
||||
/
|
||||
0
|
||||
0
|
||||
0
|
||||
before block
|
||||
after block
|
||||
@@ -171,3 +171,4 @@ echo before block
|
||||
|
||||
echo after block
|
||||
|
||||
${THIS_SH} ./redir7.sub
|
||||
|
||||
@@ -156,3 +156,18 @@ ${THIS_SH} ./redir5.sub
|
||||
|
||||
# test behavior after a write error with a builtin command
|
||||
${THIS_SH} ./redir6.sub
|
||||
|
||||
# problem with redirections using fds bash uses internally
|
||||
: ${TMPDIR:=/tmp}
|
||||
|
||||
trap 'rm -f $TMPDIR/bash-redir-$$' 0 1 2 3 6 15
|
||||
|
||||
echo before block
|
||||
{
|
||||
echo before redir
|
||||
exec 10>&1
|
||||
echo after redir
|
||||
} > $TMPDIR/bash-redir-$$
|
||||
|
||||
echo after block
|
||||
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
# weird redirections that caused trouble and were fixed in post-3.0 bash
|
||||
stuff()
|
||||
{
|
||||
c=1
|
||||
( sleep 5 < /dev/null >/dev/null 2>&1 & ) &
|
||||
}
|
||||
|
||||
exec 3>&1
|
||||
eval `
|
||||
exec 4>&1 >&3 3>&-
|
||||
{
|
||||
stuff 4>&-
|
||||
echo "c=$c" >&4
|
||||
}`
|
||||
echo c1 is $c
|
||||
|
||||
unset -f stuff
|
||||
|
||||
stuff()
|
||||
{
|
||||
c=2
|
||||
( sleep 5 < /dev/null >/dev/null 2>&1 & )
|
||||
}
|
||||
|
||||
exec 3>&1
|
||||
eval `
|
||||
exec 4>&1 >&3 3>&-
|
||||
{
|
||||
stuff 4>&-
|
||||
echo "c=$c" >&4
|
||||
}`
|
||||
echo c2 is $c
|
||||
|
||||
unset -f stuff
|
||||
|
||||
stuff()
|
||||
{
|
||||
c=3
|
||||
{ sleep 5 < /dev/null >/dev/null 2>&1 & } &
|
||||
}
|
||||
|
||||
exec 3>&1
|
||||
eval `
|
||||
exec 4>&1 >&3 3>&-
|
||||
{
|
||||
stuff 4>&-
|
||||
echo "c=$c" >&4
|
||||
}`
|
||||
echo c3 is $c
|
||||
|
||||
unset -f stuff
|
||||
|
||||
stuff()
|
||||
{
|
||||
c=4
|
||||
{ sleep 5 < /dev/null >/dev/null 2>&1 & }
|
||||
}
|
||||
|
||||
exec 3>&1
|
||||
eval `
|
||||
exec 4>&1 >&3 3>&-
|
||||
{
|
||||
stuff 4>&-
|
||||
echo "c=$c" >&4
|
||||
}`
|
||||
echo c4 is $c
|
||||
|
||||
Reference in New Issue
Block a user