Этот gawk
скрипт проанализирует ip addr show
, чтобы предоставить вам запрошенную информацию. Несколько адресов IPv4 объединяются запятой
ip a | awk 'function outline() {if (link>"") {printf "%s %s %s\n", iface, inets, link}} $0 ~ /^[1-9]/ {outline(); iface=substr($2, 1, index($2,":")-1); inets=""; link=""} $1 == "link/ether" {link=$2} $1 == "inet" {inet=substr($2, 1, index($2,"/")-1); if (inets>"") inets=inets ","; inets=inets inet} END {outline()}'
Разделить это, чтобы было читабельнее,
ip addr show |
awk '
# Output function to format results (if any)
function outline() {
if (link>"") {printf "%s %s %s\n", iface, inets, link}
}
# Interface section starts here
$0 ~ /^[1-9]/ {
outline(); # Output anything we previously collected
iface=substr($2, 1, index($2,":")-1); # Capture the interface name
inets=""; # Reset the list of addresses
link="" # and MAC too
}
# Capture the MAC
$1 == "link/ether" {
link=$2
}
# Capture an IPv4 address. Concatenate to previous with comma
$1 == "inet" {
inet=substr($2, 1, index($2,"/")-1); # Discard /nn subnet mask
if (inets>"") inets=inets ","; # Suffix existing list with comma
inets=inets inet # Append this IPv4
}
# Input processing has finished
END {
outline() # Output remaining collection
}
'
Пример вывода
eth0 10.0.2.15 08:00:27:0f:db:b3
eth1 192.168.56.101 08:00:27:33:04:26
Я понял. Если вам интересно, как это сделать, перейдите к /usr/share/gnome-shell/extensions/zorin-app-grid@zorinos.com
и измените zorin-icon-symbolic.svg
на свое изображение
Иконка Дир:/usr/share/icons/hicolor/symbolic/apps/
Сначала преобразуйте свой логотип png в файл svg.
Используйте его:https://onlineconvertfree.com/tr/convert-format/png-to-svg/
И переименовать :"xfce4 -zorinmenulite -symbolic.svg"
Иконка фильма реж.