1# This program is free software: you can redistribute it and/or modify 2# it under the terms of the GNU General Public License as published by 3# the Free Software Foundation, either version 3 of the License, or 4# (at your option) any later version. 5# 6# This program is distributed in the hope that it will be useful, 7# but WITHOUT ANY WARRANTY; without even the implied warranty of 8# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 9# GNU General Public License for more details. 10# 11# You should have received a copy of the GNU General Public License 12# along with this program. If not, see <http://www.gnu.org/licenses/>. 13# 14# process substitution constructs that have caused problems in the past 15. ./test-glue-functions 16 17eval cat <(echo test1) 18eval "echo foo;cat" <(echo test2) 19 20# this doesn't work, and it never should have 21#unset f 22#f=<(echo test3); cat "$f" 23 24unset f 25eval f=<(echo test4) "; cat \$f" 26 27unset f 28 29FN=$TMPDIR/bashtest-procsub-$$ 30cat >"$FN" <<EOF 31echo "test 12" | wc -c | _cut_leading_spaces 32cat "\$1" 33EOF 34 35source "$FN" <(echo test5) 36rm -f "$FN" 37unset FN 38 39cat <( echo test6 ) <( echo test7 ) 40cat <( echo test8 ; sleep 2; echo test8a ) <( echo test9 ) 41 42# Zev Weiss 11/7/2012 43fn() { cat | cat "$1"; } 44fn <(:) < /dev/null 45 46unset -f fn 47 48f1(){ 49 cat $1 50 date >/dev/null 51} 52f2(){ 53 date >/dev/null 54 cat $1 55} 56cat <(echo hi) 57f1 <(echo bye) 58f2 <(echo l8r) 59 60unset -f f1 f2 61 62# set up conditions for test 63ulimit -n 256 64 65bug() 66{ 67c=$(ulimit -n) 68let c+=100 69while let c-- 70do 71 while read -ru3 x 72 do 73 echo -n : 74 done 3< <(echo x) 75done 76echo 77} 78 79bug 80unset -f bug 81 82count_lines() 83{ 84 wc -l < $1 85 86 case "$1" in 87 *sh-np*) [ -e "$1" ] || { echo 0; echo 0; echo 0; echo 0; return; } ;; 88 *) ;; 89 esac 90 91 wc -l < $1 92 wc -l < $1 93 true | wc -l < $1 94 wc -l < $1 95} 96 97echo intern 98count_lines <(date) | _cut_leading_spaces 99unset -f count_lines 100 101echo extern 102FN=$TMPDIR/bashtest-$$ 103cat >$FN << \EOF 104wc -l < $1 105case $1 in *sh-np*) [ -e $1 ] || { echo 0; echo 0; echo 0; echo 0; return; } ;; esac 106wc -l < $1 107wc -l < $1 108true | wc -l < $1 109wc -l < $1 110EOF 111 112${THIS_SH} -c "source $FN <(date)" | _cut_leading_spaces 113rm -f $FN 114 115moo() { ls -l "$1" >/dev/null; ls -l "$1" >/dev/null; }; moo >(true) 116moo() { ls -al "$1" >/dev/null; (true); ls -al "$1" >/dev/null; }; moo >(true) 117 118unset -f moo 119 120${THIS_SH} ./procsub1.sub 121${THIS_SH} ./procsub2.sub 122