either function not_run_from_ssh () { pgrep "${PPID}.*sshd" } or function not_run_from_ssh () { return [ -n "$SSH_TTY" ] }