Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement a more robust remote connection detection (who)
First, we switch from `who am i` to `who -m` because this is the POSIX way and macOS supports it as well. Second, if the above fails, we fall back to using just `who` and grep the line that represents our TTY. This works e.g. with busybox systems. Finally, we use (extremely) simplified regular expressions for detecting IPv4, IPv6 and hostname. This is a best-effort attempt at detecting the remote connections when SSH_CONNECTION is not set.
- Loading branch information