Denys Vlasenko | df303ae | 2016-10-02 18:32:52 +0200 | [diff] [blame] | 1 | rm *shell_test* 2>/dev/null |
| 2 | |
| 3 | >\shell_test |
| 4 | echo *shell_test* |
| 5 | rm *shell_test* |
| 6 | |
| 7 | >\\shell_test |
| 8 | echo *shell_test* |
| 9 | rm *shell_test* |
| 10 | |
| 11 | >"\shell_test" |
| 12 | echo *shell_test* |
| 13 | rm *shell_test* |
| 14 | |
| 15 | >"\\shell_test" |
| 16 | echo *shell_test* |
| 17 | rm *shell_test* |
| 18 | |
| 19 | |
| 20 | cat <<\shell_test |
| 21 | Here1 |
| 22 | shell_test |
| 23 | echo Ok1 |
| 24 | |
| 25 | cat <<\\shell_test |
| 26 | Here2 |
| 27 | \shell_test |
| 28 | echo Ok2 |
| 29 | |
| 30 | cat <<"\shell_test" |
| 31 | Here3 |
| 32 | \shell_test |
| 33 | echo Ok3 |
| 34 | |
| 35 | cat <<"\\shell_test" |
| 36 | Here4 |
| 37 | \shell_test |
| 38 | echo Ok4 |
| 39 | |
| 40 | |
| 41 | echo Now with variable refs |
| 42 | i=1 |
| 43 | |
| 44 | |
| 45 | >\shell_test_$i |
| 46 | echo *shell_test* |
| 47 | rm *shell_test* |
| 48 | |
| 49 | >\\shell_test_$i |
| 50 | echo *shell_test* |
| 51 | rm *shell_test* |
| 52 | |
| 53 | >"\shell_test_$i" |
| 54 | echo *shell_test* |
| 55 | rm *shell_test* |
| 56 | |
| 57 | >"\\shell_test_$i" |
| 58 | echo *shell_test* |
| 59 | rm *shell_test* |
| 60 | |
| 61 | echo Done;exit |
| 62 | # UNFIXED BUG. bash apparently will expand $i even in terminating delimiter. |
| 63 | # http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html |
| 64 | # does not mandate this behavior. |
| 65 | # This is not likely to be used much in real-world. |
| 66 | |
| 67 | cat <<\shell_test_$i |
| 68 | Here1 |
| 69 | shell_test_$i |
| 70 | echo Ok1 |
| 71 | |
| 72 | cat <<\\shell_test_$i |
| 73 | Here2 |
| 74 | \shell_test_$i |
| 75 | echo Ok2 |
| 76 | |
| 77 | cat <<"\shell_test_$i" |
| 78 | Here3 |
| 79 | \shell_test_$i |
| 80 | echo Ok3 |
| 81 | |
| 82 | cat <<"\\shell_test_$i" |
| 83 | Here4 |
| 84 | \shell_test_$i |
| 85 | echo Ok4 |