16 lines
500 B
Bash
Executable File
16 lines
500 B
Bash
Executable File
#!/bin/sh
|
|
|
|
|
|
printf '['
|
|
delimiter=""
|
|
virsh net-list --all | tail -n +3 | awk '{ print $1 }' | while read -r network_name; do
|
|
if [ "$network_name" != "" ]; then
|
|
virtual_bridge_name="$(virsh net-info "$network_name" | grep -E '^Bridge:' | awk '{ print $2 }')"
|
|
capsul_state="$(echo "$line" | sed -E 's/^ *[0-9-]+ +[^ ]+ +//')"
|
|
printf '%s\n {"network_name":"%s", "virtual_bridge_name":"%s"}' "$delimiter" "$network_name" "$virtual_bridge_name"
|
|
delimiter=","
|
|
fi
|
|
done
|
|
printf '\n]\n'
|
|
|