求教/bin/ps -ef|grep "$1"|grep grep和/bin/ps -ef|grep grep的区别

sh/bash/dash/ksh/zsh等Shell脚本
回复
糊涂的小强
帖子: 71
注册时间: 2014-04-28 14:33
系统: ubuntu12&centos6

求教/bin/ps -ef|grep "$1"|grep grep和/bin/ps -ef|grep grep的区别

#1

帖子 糊涂的小强 » 2014-06-17 11:44

[xxxx@localhost ~]$ /bin/ps -ef|grep grep
xxxx 16166 2433 0 11:03 pts/0 00:00:00 grep grep
[xxxx@localhost ~]$ /bin/ps -ef|grep "$1"|grep grep
xxxx 16199 2433 0 11:14 pts/0 00:00:00 grep
xxxx 16200 2433 0 11:14 pts/0 00:00:00 grep grep
grep "$1"的作用是什么
sk1418
帖子: 229
注册时间: 2007-07-01 17:36
系统: (En):System
来自: (En):address
联系:

Re: 求教/bin/ps -ef|grep "$1"|grep grep和/bin/ps -ef|grep grep的

#2

帖子 sk1418 » 2014-06-17 16:45

$1 在双引号里会引起变量expansion, 就是$1 变量啦.
我觉得那行就没用, 除了加个grep 进程.
---
regards,

Kent
糊涂的小强
帖子: 71
注册时间: 2014-04-28 14:33
系统: ubuntu12&centos6

Re: 求教/bin/ps -ef|grep "$1"|grep grep和/bin/ps -ef|grep grep的

#3

帖子 糊涂的小强 » 2014-06-18 21:01

sk1418 写了:$1 在双引号里会引起变量expansion, 就是$1 变量啦.
我觉得那行就没用, 除了加个grep 进程.
就是不明白怎么过滤出grep grep的哦
回复