macOS/BSD: fix IP retrieval

`\s` for matching spaces is a GNU-sed extension.

The portable way is to use `[[:space]]` instead.
This commit is contained in:
Pierre de La Morinerie 2017-10-16 11:42:49 +05:30
parent 25c24071bc
commit 4d7e3182ff

View file

@ -190,7 +190,7 @@ VERSION as stable, testing or unstable /!\ "
vagrant up $VMNAME --provider virtualbox vagrant up $VMNAME --provider virtualbox
# Warn user about hosts file # Warn user about hosts file
IP_LINE="\s\s*${VMNAME}.vm.network\s\s*:private_network,\s*ip:\s*\"" IP_LINE="[[:space:]]*${VMNAME}.vm.network[[:space:]]*:private_network,[[:space:]]*ip:[[:space:]]*\""
IP=$(grep "$IP_LINE" Vagrantfile | sed "s/${IP_LINE}//" | tr -d '"') IP=$(grep "$IP_LINE" Vagrantfile | sed "s/${IP_LINE}//" | tr -d '"')
echo "/!\ Please add '$IP $DOMAIN' to your /etc/hosts file /!\\" echo "/!\ Please add '$IP $DOMAIN' to your /etc/hosts file /!\\"
echo "sudo bash -c 'echo \"$IP $DOMAIN\" >> /etc/hosts'" echo "sudo bash -c 'echo \"$IP $DOMAIN\" >> /etc/hosts'"