+ -
当前位置:首页 → 问答吧 → shell script如何获取返回的参数

shell script如何获取返回的参数

时间:2011-07-12

来源:互联网

如题,比如说我要用 grep -c 'login.action' localhost_111.txt ,那么我如何在shell中获取得到的个数呢?小弟刚学linux,求高手解答。

作者: lost_guy_in_scut   发布时间: 2011-07-12

JScript code

myvar=`grep -c 'login.action' localhost_111.txt`
echo $myvar 

作者: thefirstz   发布时间: 2011-07-12

或者grep -c 'login.action' localhost_111.txt | wc -l

作者: thefirstz   发布时间: 2011-07-12

n=`grep -c 'login.action' localhost_111.txt`

作者: zmlovelx   发布时间: 2011-07-12