亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

Chinaunix

標(biāo)題: 利用xargs命令復(fù)制路由條目,求解。 [打印本頁]

作者: bfdhczw    時(shí)間: 2014-05-28 13:21
標(biāo)題: 利用xargs命令復(fù)制路由條目,求解。
我執(zhí)行如下命令
ip ro | grep "eth2" | xargs -I {} ip ro add {} table 10
我期望xargs構(gòu)造出來的命令是:ip ro add 169.254.0.0/16 dev eth2  scope link  metric 1000 table 10
但實(shí)際構(gòu)造出來的命令卻是:ip ro add "169.254.0.0/16 dev eth2  scope link  metric 1000" table 10
這個(gè)命令要怎么寫?

或者有什么別的簡(jiǎn)單方法可以達(dá)成目的?
作者: expert1    時(shí)間: 2014-05-28 14:59
看不出來什么區(qū)別
ip ro|awk '/eth2{print xxxxxx}
作者: jason680    時(shí)間: 2014-05-28 15:03
回復(fù) 1# bfdhczw

try this way...

$ ip ro | awk '/eth2/{system("echo ip ro add "$0" table 10")}'

Note: remove the echo command when you got the right answer on screen   
作者: bfdhczw    時(shí)間: 2014-05-28 15:52
回復(fù) 3# jason680

thanks, it is exactly what I want.
   
作者: bfdhczw    時(shí)間: 2014-05-28 15:58
回復(fù) 2# expert1

區(qū)別在于,帶引號(hào)的會(huì)把引號(hào)內(nèi)的內(nèi)容整體作為一個(gè)參數(shù);而不帶引號(hào)的會(huì)以空格為分割,傳遞多個(gè)參數(shù)。
   




歡迎光臨 Chinaunix (http://www.72891.cn/) Powered by Discuz! X3.2