#!/bin/bash
ip=`ip address |grep inet[^6]|grep -vE "127.0.0.1|docker"|sed -r 's# inet (.*)/[0-9].*#\1#'`
mac=`ip address|grep eth[0-9] -A1|grep link/ether|sed -r 's# link/ether (.*) brd.*#\1#'`
echo "$ip,$mac"
注:ip或排除本地及docker,mac同样也排除与之有关,只取物理网卡信息