Created
November 2, 2022 18:20
-
-
Save tashrifbillah/436805f1534d170eeb9f20541bc7a495 to your computer and use it in GitHub Desktop.
Obtain MAC addresses in CSV format
This file contains hidden or 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 | |
# master script | |
for p in $(cat ip_addr.txt) | |
do | |
echo -n 172.21.$p,; ssh [email protected].$p -i ~/.ssh/id_ecdsa -o StrictHostKeyChecking=no -C "~/get_mac_addr.sh"; done | |
# slave script | |
str1=`ip addr | grep BROADCAST,MULTICAST,UP,LOWER_UP` | |
IFS=': ' read -ra names <<< $str1 | |
echo `hostname -f`,`cat /sys/class/net/${names[1]}/address` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment