A set of servers that I SSH into use a switch statement in the default .bashrc to make system-specific configurations:
case "$HOSTNAME" in: systemA*|systemB|) # some local definitions here ;; systemC*|systemD|) # some local definitions here ;; *) echo "No bashrc definitions for $HOSTNAME" esac
But I also use bash on my Mac locally, so I decided to be a smartarse and extend this statement to include a case for when I'm not SSHing into another statement.
However, the Mac often changes my preferred hostname based on my network environment (usually when I'm wired in at work, rather than on Wi-Fi at home, but I assume this is down to the DHCP configuration). I'm aware that I can override it, but is the best idea? Is there a better solution for having bashrc settings that are only in effect when I'm not in a remote shell?