1
0
mirror of https://github.com/gryf/vmstrap.git synced 2025-12-19 04:20:26 +01:00

Move out search for firts ip to the separate script.

This commit is contained in:
2021-05-06 14:49:45 +02:00
parent b1bc70db61
commit e86dd6fb12
2 changed files with 11 additions and 11 deletions

11
get_first_dev_ip.sh Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/bash
for i in $(seq 0 3); do
ifname=$(ip -j a|jq -r .[$i].ifname)
if [[ "${ifname}" = "lo" ]]; then
continue
fi
echo $(ip -j a|jq -r \
".[$i].addr_info[] | select(.family == \"inet\") | .local")
break;
done