I want my shell to detect if human behavior, then show the prompt.
So, assume the file name is test.bash
#!/bin/bash if [ \"x\" != \"${PS1:-x}\" ] ;t
You could make use of the /usr/bin/tty program:
/usr/bin/tty
if tty -s then # ... fi
I admit that I'm not sure how portable it is, but it's at least part of GNU coreutils.