This topic has been archived. It cannot be replied.
-
工作学习 / 学科技术讨论 / su and awk: HELP!Hi,
I would like to run awk with different user identities, so I invoke awk from su as root:
# su alelai -c "awk '($0 ~ /sbtorsvr329/) {print $1}' /home/alelai/.ssh/known_hosts"
the command return silently.
but the same awk command gives the following output when run directly:
sbtorsvr237{alelai}: awk '($0 ~ /sbtorsvr329/) {print $1}' /home/alelai/.ssh/known_hosts
sbtorsvr329,172.22.12.187
Can anybody point out what is wrong?
Thanks in andvance.
-newstart12(Alex);
2008-12-16
{478}
(#4925155@0)
-
你在$0前面加个backslash "\"再试一下
-buma(四眼鲁道夫);
2008-12-16
(#4925211@0)
-
高手呐, 还有 $1
-vetra(豆泡松果 之 多泡泡);
2008-12-16
(#4925354@0)
-
高手啊,什么时候把你偶像们召集一下,集体崇拜一下
-buma(四眼鲁道夫);
2008-12-16
(#4925381@0)
-
集体 崇拜 显得没有诚意,要一个个败过来
-vetra(豆泡松果 之 多泡泡);
2008-12-16
(#4925500@0)
-
You solved the problem. Thank you so much!
-newstart12(Alex);
2008-12-16
(#4925431@0)
-
帮助菜鸟是小鸟的责任,老鸟忙着搞个人崇拜了
-buma(四眼鲁道夫);
2008-12-16
(#4925434@0)