[kwlug-disc] Question about `ps` and `grep`

Ronald Barnes ron at ronaldbarnes.ca
Fri Sep 27 19:27:35 EDT 2024


Chris Craig wrote on 2024-09-27 04:16:

> On Thu, Sep 26, 2024 at 10:14 PM Ronald Barnes via kwlug-disc 
> <kwlug-disc at kwlug.org <mailto:kwlug-disc at kwlug.org>> wrote:
> 
> I spent an embarrassing amount of time on this, and Chris's reply 
> actually left me equally baffled.
> 
> 
> Sorry about that, I should have gone into more detail. I should have
>  elaborated about the string itself, since it wasn't just 'tmux' but
> the entire line from the `ps` output. Also the way I described it was
> a bit backwards - it's more correct (arguably) to say that the regex
> pattern didn't match the string.
I'd even asked ChatGPT (4o mini) this question and its answer was quite 
good, but it still didn't trigger understanding:

 > The grep [t]mux command searches for the term "tmux". The square
 > brackets around the "t" create a character class that matches the
 > letter "t". This means that it will match "tmux" but not the literal
 > string "grep tmux".

I was really dumb this week.



rb



More information about the kwlug-disc mailing list