if tty -s; then
echo "Standard input is a TTY (interactive mode)."
else
echo "Standard input is not a TTY (e.g., piped or redirected)."
fi
Now I wonder how _isatty_ itself detects whether a file descriptor is associated with a terminal!