On 2016/04/25 at 14:42, Pratyush Anand wrote:
Hi Xunlei,
On 25/04/2016:12:39:20 PM, Xunlei Pang wrote:
> +
> +get_hwaddr()
> +{
> + if [ -f "/sys/class/net/${1}/address" ]; then
> + awk '{ print toupper($0) }' < /sys/class/net/${1}/address
> + elif [ -d "/sys/class/net/${1}" ]; then
Probably if/else loop can be skipped and only having below two lines should do
the job for all scenarios, no?
This is originally from "/etc/sysconfig/network-scripts/network-functions", I
guess
it's for no ip utils existent cases.
Regards,
Xunlei
> + ip -o link show ${1} 2>/dev/null | \
> + awk '{ print toupper(gensub(/.*link\/[^ ]* ([[:alnum:]:]*).*/,
> + "\\1", 1)); }'
> + fi
> +}
> +
~Pratyush