Skip to content

Instantly share code, notes, and snippets.

@claudyus
Created September 15, 2014 19:31
Show Gist options
  • Save claudyus/66dd8360b505d4ea7b50 to your computer and use it in GitHub Desktop.
Save claudyus/66dd8360b505d4ea7b50 to your computer and use it in GitHub Desktop.
LXC name in hostsfile
#!/bin/bash
sed -i '/^#LXC$/,/^#END LXC$/d' /etc/hosts
echo "#LXC" >> /etc/hosts
lxc-ls -1 --fancy -F ipv4,name | grep -o ^[0-9].* >> /etc/hosts
echo "#END LXC" >> /etc/hosts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment