B OpenNebula/addon-context-linux#148: Fix missing newline on FreeBSD

pull/188/head
Vlastimil Holer 5 years ago
parent 32ddd28488
commit 3420656fcd
No known key found for this signature in database
GPG Key ID: EB549BADEFD07C53

@ -77,7 +77,8 @@ function update_hosts() {
eval "${SED_I} -re \"s/^.*[[:space:]]${name}([[:space:]#].*|$)/${entry}/\" /etc/hosts" eval "${SED_I} -re \"s/^.*[[:space:]]${name}([[:space:]#].*|$)/${entry}/\" /etc/hosts"
# create new entry # create new entry
elif [ -f /etc/hosts ]; then elif [ -f /etc/hosts ]; then
eval "${SED_I} -e \"1s/^/${entry}\"$'\\\n/' /etc/hosts" # In FreeBSD, sed doesn't interpret \n. We put a real newline.
eval "${SED_I} -e \"1s/^/${entry}\"$'\\\\\n/' /etc/hosts"
else else
echo "${entry}" >>/etc/hosts echo "${entry}" >>/etc/hosts
fi fi

Loading…
Cancel
Save