coopdevs / devenv

Simple script to create LXC development environments
8 stars 6 forks source link

fix: get only IP4 from container #47

Closed oyale closed 5 months ago

oyale commented 5 months ago

If both IP4 and IP6 address are assigned to container, editing /etc/hosts fails with following message:

Removing old host test.local from /etc/hosts
sed: -e expression #1, char 12: unterminated address regex

This PR filters the output by using grep to store only the IP4:

IP_CONTAINER="$(sudo lxc-info -n "$NAME" -iH)| grep -oP '(\d{1,3}\.){3}\d{1,3}')"
cesarlr commented 5 months ago

Let's merge!