
在 RH 6.7 上,使用bash
:
我需要使用腳本釋放一些 IP 位址。
我正在尋找一種使用命令關閉綁定的方法ifconfig xxx down
。
我用這個搜尋候選人列表:
$ ifconfig |grep ^bond[0-9]:[1-9] |awk '{print $1}'
我如何輕鬆地使用該命令的輸出到該down
命令?
xargs
不適合我:
$ ifconfig |grep ^bond[0-9]:[1-9] |awk '{print \$1}' | xargs -n 1 ifconfig down
謝謝
答案1
找到了一個不錯的選擇:
for i in `ifconfig |grep ^bond[0-9]:[1-9] |awk '{print $1}'` ; do
ifconfig $i down;
done