I have a script that is to be run by a person that logs in to the server with SSH.
Is there a way to find out automatically what IP address the user is connecting from?
Of course, I could ask the user (it is a tool for programmers, so no problem with that), but it would be cooler if I just found out.
Improving on a prior answer. Gives ip address instead of hostname. --ips not available on OS X.
more universal, change $5 to $6 for OS X 10.11: