<div dir="ltr">It's simply that the string "[t]mux" doesn't match the regex "[t]mux"<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Sep 25, 2024 at 9:07 PM Ronald Barnes via kwlug-disc <<a href="mailto:kwlug-disc@kwlug.org">kwlug-disc@kwlug.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
I watched a recent video about bash on YouTube channel "You Suck At <br>
Programming" and a comment there has me completely baffled.<br>
<br>
<br>
The topic was `pgrep` and `pkill` instead of `ps aux | grep ...`.<br>
<br>
<br>
The comment had a solution to seeing the `grep` command in the output <br>
when grep'ing `ps` output:<br>
<br>
This shows the grep command in the output:<br>
<br>
<br>
# ps aux | grep tmux<br>
root 9032 0.0 0.0 23476 5632 pts/1 S+ Sep05 0:04 sudo <br>
tmux new -s w00<br>
root 9041 0.0 0.0 23476 1560 pts/9 Ss Sep05 0:00 sudo <br>
tmux new -s w00<br>
root 9042 0.0 0.0 10916 3712 pts/9 S+ Sep05 0:00 tmux <br>
new -s w00<br>
root 9045 0.0 0.0 14236 4920 ? Ss Sep05 1:14 tmux <br>
new -s w00<br>
root 748047 0.0 0.0 9212 2560 pts/10 S+ 17:59 0:00 grep <br>
--color=auto --directories=skip tmux<br>
<br>
<br>
<br>
BUT, changing what's being grep'd for by making it [t]mux:<br>
<br>
# ps aux | grep [t]mux<br>
root 9032 0.0 0.0 23476 5632 pts/1 S+ Sep05 0:04 sudo <br>
tmux new -s w00<br>
root 9041 0.0 0.0 23476 1560 pts/9 Ss Sep05 0:00 sudo <br>
tmux new -s w00<br>
root 9042 0.0 0.0 10916 3712 pts/9 S+ Sep05 0:00 tmux <br>
new -s w00<br>
root 9045 0.0 0.0 14236 4920 ? Ss Sep05 1:14 tmux <br>
new -s w00<br>
<br>
<br>
Now grep's output is NOT shown.<br>
<br>
<br>
And I cannot figure out why not?!?<br>
<br>
<br>
I understand that [t] is a character range (of one character), but <br>
without explicit anchoring, why does that work?<br>
<br>
<br>
<br>
Anyone able to explain this?<br>
<br>
<br>
(Also, <a href="https://www.youtube.com/@yousuckatprogramming" rel="noreferrer" target="_blank">https://www.youtube.com/@yousuckatprogramming</a> channel is highly <br>
recommended - 3 to 4 minute videos, usually about `bash` topics, where <br>
there's always something I learn.<br>
<br>
Then check the comments for user "extrageneity", who expands on the <br>
topic with a Uni CS level comment.)<br>
<br>
<br>
Thanks,<br>
<br>
rb<br>
<br>
_______________________________________________<br>
kwlug-disc mailing list<br>
To unsubscribe, send an email to <a href="mailto:kwlug-disc-leave@kwlug.org" target="_blank">kwlug-disc-leave@kwlug.org</a><br>
with the subject "unsubscribe", or email<br>
<a href="mailto:kwlug-disc-owner@kwlug.org" target="_blank">kwlug-disc-owner@kwlug.org</a> to contact a human being.<br>
<br>
</blockquote></div>