Skip to content

Commit

Permalink
vmctl: cache ip address
Browse files Browse the repository at this point in the history
  • Loading branch information
gyf304 committed Jan 19, 2021
1 parent ca4fc1c commit f5ca7e8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion vmctl/vmctl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,12 @@ function get_ip {
fi
assoc="$(get_ip_mac_assoc)"
for addrfile in "$dir"/*.macaddr; do
printf "%s" "$assoc" | grep "$(cat "$addrfile")" | cut -d ' ' -f 1
prefix="${addrfile%.macaddr}"
ip=$(printf "%s" "$assoc" | grep "$(cat "$addrfile")" | cut -d ' ' -f 1)
if [ "$ip" != "" ]; then
printf "%s\n" "$ip" > "$prefix.ipaddr"
fi
cat "$prefix.ipaddr" || true
done
}

Expand Down

0 comments on commit f5ca7e8

Please sign in to comment.