Skip to content

Instantly share code, notes, and snippets.

@GaussianWonder
Created November 12, 2022 16:18
Show Gist options
  • Save GaussianWonder/2dd92e0d6bd95199ceaffe169f5acdab to your computer and use it in GitHub Desktop.
Save GaussianWonder/2dd92e0d6bd95199ceaffe169f5acdab to your computer and use it in GitHub Desktop.
#!/bin/bash
awkGrab=""
if [ -z "$1" ]
then
awkGrab="all"
else
awkGrab="$1"
fi
arpScanResult="$(sudo arp-scan --local | grep 'Raspberry')"
case "$awkGrab" in
"ip")
echo "$arpScanResult" | awk '{ print $1 }'
;;
"mac")
echo "$arpScanResult" | awk '{ print $2 }'
;;
*)
echo "$arpScanResult"
;;
esac
@GaussianWonder
Copy link
Author

Connecting to the raspberry can now look like:

ssh "username@$(find_raspberry ip)"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment