0phoi5 Posted April 3, 2017 Share Posted April 3, 2017 (edited) Hi all, I have multiple wireless devices connected to one computer and I'm trying to create a BASH script to find the LogicalName of one of them automatically. For example, I have WLAN0, WLAN1 and WLAN2 connected. I want to find the LogicalName for my 'Super Awesome WiFi Thingy'. So far I have been unable to find a line of BASH that will take the Device Name 'Super Awesome WiFi Thingy' and find which WLAN LogicalName it belongs to. Any ideas? *Edit* I need to output to a variable in format 'WLAN#', rather than just display a list of devices. Thank you. Edited April 3, 2017 by haze1434 Quote Link to comment Share on other sites More sharing options...
Jason Cooper Posted April 3, 2017 Share Posted April 3, 2017 If you know your device's MAC address you can use something like ifconfig | grep "HWaddr XX:XX:XX:XX:XX:XX" | cut -d' ' -f1 Just remember to replace the XX:XX:XX... with your device's MAC address Quote Link to comment Share on other sites More sharing options...
0phoi5 Posted April 3, 2017 Author Share Posted April 3, 2017 Looks good, thank you :) I'll give it a try later. Quote Link to comment Share on other sites More sharing options...
digip Posted April 3, 2017 Share Posted April 3, 2017 (edited) wouldn't it be ifconfig | grep Ether ? i don't see HWaddr in my console, but not sure if that is your distro/network manager specific. Edit: Just trying these things out for myself, and trying to follow along. You have 3 wifi nics, and want to know which nic is on which wireless AP at any given time? iw wlan0 link iw wlan1 link iw wlan2 link You can grep each for the "Connected to" for the AP's mac address, and SSID for each AP's name. iw has to be installed to get the info though. Edited April 3, 2017 by digip Quote Link to comment Share on other sites More sharing options...
Jason Cooper Posted April 4, 2017 Share Posted April 4, 2017 17 hours ago, digip said: wouldn't it be ifconfig | grep Ether ? i don't see HWaddr in my console, but not sure if that is your distro/network manager specific. Could well be a distro thing, I've tried it in a CentOS 6 based distro and a debian wheezy based distro, and both use HWaddr. Quote Link to comment Share on other sites More sharing options...
0phoi5 Posted April 6, 2017 Author Share Posted April 6, 2017 On 04/04/2017 at 1:01 PM, Jason Cooper said: Could well be a distro thing, I've tried it in a CentOS 6 based distro and a debian wheezy based distro, and both use HWaddr. Thanks. This would be in Raspbian, so potentially HWaddr. Still haven't had a chance to try, I'll let you guys know. Quote Link to comment Share on other sites More sharing options...
0phoi5 Posted April 20, 2017 Author Share Posted April 20, 2017 On 03/04/2017 at 0:40 PM, Jason Cooper said: If you know your device's MAC address you can use something like ifconfig | grep "HWaddr XX:XX:XX:XX:XX:XX" | cut -d' ' -f1 Just remember to replace the XX:XX:XX... with your device's MAC address This worked perfect, thank you. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.