I have a third-party shell function that's trying to use tty -s
to detect whether it's called from an interactive shell, but reports that it's in an interactive shell even when it isn't.
#!/usr/bin/env bash
get_shell_type() {
tty -s && echo "INTERACTIVE" || echo "NON-INTERACTIVE"
}
Why is this expected to work? How can I fix it?