1 |
On 8/23/19 5:21 PM, Neil Bothwick wrote: |
2 |
> On 22 August 2019 22:08:41 GMT-04:00, Andrew Udvare <audvare@×××××.com> wrote: |
3 |
>> |
4 |
>>> On 2019-08-22, at 12:31, Laurence Perkins <lperkins@×××××××.net> |
5 |
>> wrote: |
6 |
>>> |
7 |
>>> A common tactic is to use grep twice: |
8 |
>>> ps auxf | grep -v grep | grep blah |
9 |
>> |
10 |
>> Or grep with brackets: |
11 |
>> |
12 |
>> ps aux | grep '[f]irefox' |
13 |
>> |
14 |
>> I have a function for this: |
15 |
>> |
16 |
>> psgrep() { |
17 |
>> ps aux | grep "[${1:0:1}]${1:1}"; |
18 |
>> } |
19 |
>> |
20 |
>> This works because the ps output will have "grep [f]irefox" and the |
21 |
>> regex can't match that line (without escaping the [] again). |
22 |
> |
23 |
> Or just use pgrep, I usually use pgrep - fa. |
24 |
> |
25 |
|
26 |
Ah, that is what I was looking for |
27 |
|
28 |
thx, |
29 |
James |