如何快速将主机名添加到etchosts文件中?

摘要:cp etchosts etchosts_bak hostname |xargs echo 127.0.0.1 >> etchosts
cp /etc/hosts /etc/hosts_bak hostname |xargs echo 127.0.0.1 >> /etc/hosts