Created
September 30, 2023 21:21
-
-
Save krab7191/42b13a6f9c0ee9aad0f798ddbacd70f3 to your computer and use it in GitHub Desktop.
Shell script to SSH to raspberry pi wherever I am
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
network=$(iwgetid -r) | |
echo "Connected to network: " | |
echo $network | |
if [ "$network" = "<Your home wifi SSID>" ]; then | |
echo "At home, SSH to pi on local network" | |
ssh username@pi-local-ip | |
else | |
echo "Not at home, SSH to pi at home public IP" | |
ssh username@home-public-ip-address | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment