e36freak 1509376568 learn you can see if a file descriptor is open on a tty with test -t. [[ -t 1 ]] && echo 'stdout is open on a tty' greycat 1593010581 forget greycat 1593010582 learn You can see whether a file descriptor is open on a terminal with test -t. Many programs perform a check like this and change their behavior: ls, GNU grep, git, systemctl, etc.