在SH和bash指派,之间的区别 [英] Difference between pgrep in sh and bash

查看:81
本文介绍了在SH和bash指派,之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是测试:

$ bash -c "pgrep -f novalidname"
$ sh -c "pgrep -f novalidname"
11202

为什么指派,给输出 SH 运行时? (据我可以看到,有一个名为我的电脑上没有进程 novalidname

Why is pgrep giving output when run from sh? (As far as I can see, there are no processes on my computer that is named novalidname)

推荐答案

这可能是一个时间的问题,指派,发现自己,因为你与发卡它 -f novalidname 是在命令行present。与 -l <​​/ code>尝试进行确认。

It's probably a timing issue and pgrep finds itself, as you're issuing it with -f and novalidname is present in the command line. Try with -l to confirm.

这篇关于在SH和bash指派,之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆