Another solution, using udevadm
udevadm info -a -p /sys/class/net/eth{0..10} | awk '/device.*eth/'
{0..10} – checks the initerfaces from eth0 … eth10
Therefore you could use this command
pci_address=$(udevadm info -a -p /sys/class/net/eth{0..10} | awk -F/ '/device.*eth/ {print $4}')
Example output
looking at device '/devices/pci0000:00/0000:00:03.0/net/eth0':
Therefore the address is
0000:00:03.0
Or in your case with a single command
% pci_address=$(udevadm info -a -p /sys/class/net/eth{0..10} | awk -F/ '/device.*eth/ {print $4}')
% echo $pci_address
0000:00:03.0
or in a script
#!/bin/bash
udevadm info -a -p /sys/class/net/"$1" | awk -F/ '/device.*eth/ {print $4}'
Call the script with
script_name eth0
Output is
0000:00:03.0