tests/fixtures/util/is_a_tty.sh
raw| 1 | #!/bin/bash |
| 2 | |
| 3 | if [ -t 0 ] ; then |
| 4 | echo "stdin is a tty" |
| 5 | echo "terminal size: $(stty size)" |
| 6 | else |
| 7 | echo "stdin is not a tty" |
| 8 | fi |
| 9 | |
| 10 | if [ -t 1 ] ; then |
| 11 | echo "stdout is a tty" |
| 12 | else |
| 13 | echo "stdout is not a tty" |
| 14 | fi |
| 15 | |
| 16 | if [ -t 2 ] ; then |
| 17 | echo "stderr is a tty" |
| 18 | else |
| 19 | echo "stderr is not a tty" |
| 20 | fi |
| 21 | |
| 22 | >&2 echo "This is an error message." |
| 23 | |
| 24 | true |