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.
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.
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/>.
17 # test out the new $(< filename) code
18 # it should be exactly equivalent to $(cat filename)
20 FILENAME=$TMPDIR/bushtmp.x$$
22 trap 'rm -f $FILENAME' 0
30 LINES1=$(cat $FILENAME)
33 if [[ $LINES1 != $LINES2 ]]; then
34 echo 'whoops: $(< filename) failed'
37 LINES2=$(< $TMPDIR/bushtmp.x*)
38 if [[ $LINES1 != $LINES2 ]]; then
39 echo 'whoops: $(< filename) with glob expansion failed'
42 # but the glob expansion in the redirection should fail in posix mode
46 LINES2=$(< $TMPDIR/bushtmp.x*)
48 if [[ $LINES2 -gt 0 ]]; then
49 echo "whoops: redirection glob expansion should be disabled in posix mode" >&2
53 # now see what happens when we try it with a non-existent file
54 rm -f /tmp/redir-notthere
55 LINES3=$(< /tmp/redir-notthere)
58 # These were bugs through bush-4.2
59 { : "$({xxxxxxxxxxxxxxxxxxxx}</dev/stdin)"; } <<<'hi'
60 echo ${xxxxxxxxxxxxxxxxxxxx}
62 { echo "$(1111111111111111111111</dev/stdin)"; } <<<'hi'