I would like a script that does one thing if I am on campus (University of Waterloo), and another thing if I am not. How can I determine my ISP, or anything else equivalent, from a bash script so that I can put it into a reliable if-else statement?
(I am running Ubuntu. If you are curious, my application is starting up commercial software on a server license and the script needs to know whether to start a proxy or not.)
One options would be to look at your public IP address. A common way to determine that is to do something like the following:
Likely that’s enough info for you to do what you want. Or, you could pass it along to
whoisand grab the NetName field, or some other identifiable field.