pgrep 报错

遇到奇怪报错啊。

搞半天,原来是引号的问题啊。

如下, 可以看到  pgrep -a 'tc*'  加个引号就好了。单双引号都可以。 但是没有就不行。

为什么呢? 估计是被展开为 当前目录下的文件了吧。


OCBS[353]:/home/ocbs/ibsbase> pgrep -a hbo
2208631 hboxctl start_region OCBS
2208634 hboxam OCBS 32786
2208635 hboxqm OCBS 32786
2208637 hboxas OCBS 32786 0
OCBS[353]:/home/ocbs/ibsbase> pgrep  -a hbox*
2208631 hboxctl start_region OCBS
2208634 hboxam OCBS 32786
2208635 hboxqm OCBS 32786
2208637 hboxas OCBS 32786 0
OCBS[353]:/home/ocbs/ibsbase> pgrep  -a tco*
pgrep: only one pattern can be provided
Try `pgrep --help' for more information.
OCBS[353]:/home/ocbs/ibsbase> pgrep  -a tc*
pgrep: only one pattern can be provided
Try `pgrep --help' for more information.
OCBS[353]:/home/ocbs/ibsbase> pgrep  -a tcp*
OCBS[353]:/home/ocbs/ibsbase> pgrep  -a tcotc*
pgrep: only one pattern can be provided
Try `pgrep --help' for more information.
OCBS[353]:/home/ocbs/ibsbase> pgrep  -a tcotcp*
pgrep: only one pattern can be provided
Try `pgrep --help' for more information.
OCBS[353]:/home/ocbs/ibsbase> 
OCBS[353]:/home/ocbs/ibsbase> pgrep -a tco*
pgrep: only one pattern can be provided
Try `pgrep --help' for more information.
OCBS[353]:/home/ocbs/ibsbase> pgrep -a 'tco*'
79 watchdogd
508 card0-crtc0
509 card0-crtc1
510 card0-crtc2
511 card0-crtc3
512 card0-crtc4
513 card0-crtc5
514 card0-crtc6
515 card0-crtc7
861 /usr/sbin/sedispatch
895 /usr/libexec/switcheroo-control
1838 /usr/libexec/gsd-smartcard
2209303 tcotcp 
2209398 tcotcp 
OCBS[353]:/home/ocbs/ibsbase> pgrep  -a hbox*
2208631 hboxctl start_region OCBS
2208634 hboxam OCBS 32786
2208635 hboxqm OCBS 32786
2208637 hboxas OCBS 32786 0
OCBS[353]:/home/ocbs/ibsbase> pgrep  -a h*
pgrep: only one pattern can be provided
Try `pgrep --help' for more information.
OCBS[353]:/home/ocbs/ibsbase> pgrep  -a hb*
pgrep: only one pattern can be provided
Try `pgrep --help' for more information.
OCBS[353]:/home/ocbs/ibsbase> ll hb*
-rwxr-xr-x 1 ocbs ocbs 17573  6月  8  2021 hbasefun.h
-rwxr-xr-x 1 ocbs ocbs   292  6月  8  2021 hbase.h
OCBS[353]:/home/ocbs/ibsbase> ll hbox*
ls: 无法访问 'hbox*': 没有那个文件或目录
OCBS[353]:/home/ocbs/ibsbase> ll  tco*
-rwxr-xr-x 1 ocbs ocbs 30057  6月 23  2021 tcotcp.dbC
-rwxr-xr-x 1 ocbs ocbs 30103  6月  8  2021 tcotcp.dbC_bak
-rwxr-xr-x 1 ocbs ocbs 30057  6月 21  2021 tcotcp.dbC.jhq
OCBS[353]:/home/ocbs/ibsbase> 
 pgrep -a '*'
无效的前导常规表达式OCBS[353]:

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值