mirror of
https://github.com/YunoHost-Apps/linuxdash_ynh.git
synced 2024-09-03 19:36:07 +02:00
17 lines
424 B
Bash
17 lines
424 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
arpCommand=$(command -v arp)
|
||
|
|
||
|
result=$($arpCommand | awk 'BEGIN {print "["} NR>1 \
|
||
|
{print "{ \"address\": \"" $1 "\", " \
|
||
|
"\"hw_type\": \"" $2 "\", " \
|
||
|
"\"hw_address\": \"" $3 "\", " \
|
||
|
"\"flags\": \"" $4 "\", " \
|
||
|
"\"mask\": \"" $5 "\" }, " \
|
||
|
} \
|
||
|
END {print "]"}' \
|
||
|
| /bin/sed 'N;$s/},/}/;P;D')
|
||
|
|
||
|
if [ -z "$result" ]; then echo {}
|
||
|
else echo $result
|
||
|
fi
|