Computer touching incompetence 

What is the best way to circumvent that ps ax | grep something also will include the grep process itself?

Computer touching incompetence 

Just discovered another problem in my logic :blobfacepalm:

I wanted to write a script waitfor that keeps grepping for a command and then beeps a few times when it's done
Where the syntax would be e.g. waitfor sleep 10 to grep for a process sleep 10

But, of course, invoking waitfor sleep 10 creates another process with sleep 10 in the name

Although... now that I'm typing this out, I could use $$ to get the process ID of the current process and suppress it in ps

re: Computer touching incompetence 

@vaporeon_ do you not have psutils on this system? pgrep specifically?

re: Computer touching incompetence 

@aescling I have it, but it doesn't solve this problem

pgrep can prevent the grep itself from appearing in the output

But it can't prevent my script from which I invoke pgrep from appearing in the output if I invoked waitfor sleep 10

Follow

re: Computer touching incompetence 

@vaporeon_ if you are willing to search fur exactly a specific arglist there’s pgrep -f -x

Sign in to participate in the conversation
📟🐱 GlitchCat

A small, community‐oriented Mastodon‐compatible Fediverse (GlitchSoc) instance managed as a joint venture between the cat and KIBI families.