blob: e83777993401e7bb6cd592ab8fba33a601bab1a6 [file] [log] [blame]
Jari Aaltocce855b1998-04-17 19:52:44 +00001export LC_ALL=C
2export LANG=C
3
4# test out the new $(< filename) code
5# it should be exactly equivalent to $(cat filename)
6
7FILENAME=/tmp/bashtmp.x$$
8
9trap 'rm -f $FILENAME' 0
10
11cat >$FILENAME << EOF
12line 1
13line 2
14line 3
15EOF
16
17LINES1=$(cat $FILENAME)
18LINES2=$(< $FILENAME)
19
20if [[ $LINES1 != $LINES2 ]]; then
21 echo 'whoops: $(< filename) failed'
22fi
23
24LINES2=$(< /tmp/bashtmp.x*)
25if [[ $LINES1 != $LINES2 ]]; then
26 echo 'whoops: $(< filename) with glob expansion failed'
27fi
28
29# but the glob expansion in the redirection should fail in posix mode
30set -o posix
31LINES2=$(< /tmp/bashtmp.x*)
32set +o posix
33
34# now see what happens when we try it with a non-existant file
35LINES3=$(< /tmp/redir-notthere)
36echo $?
Chet Rameyac50fba2014-02-26 09:36:43 -050037
38# These were bugs through bash-4.2
39{ : "$({xxxxxxxxxxxxxxxxxxxx}</dev/stdin)"; } <<<'hi'
40echo ${xxxxxxxxxxxxxxxxxxxx}
41
42{ echo "$(1111111111111111111111</dev/stdin)"; } <<<'hi'