Mangeshrex / rxfetch

A custom system info fetching tool
GNU General Public License v3.0
451 stars 39 forks source link

pgrep -m errors #48

Closed lumikalt closed 2 years ago

lumikalt commented 2 years ago

In the script step where it checks for the dw/wm, calling pgrep-m errors, as it does not appear to be a valid flag. Instead, it prints the usage help for pgrep. Maybe I need another version?

Using fish on kitty, in EndeavourOS.

Mangeshrex commented 2 years ago

Yes trying updating to latest version of pgrep

lumikalt commented 2 years ago

I'm running the latest, still shows no -m flag support...

owl4ce commented 2 years ago

Indeed. Procps-ng pgrep(1) doesn't have the -m flag, which most Linux distributions use. So, I was wondering which version of pgrep it's ..

lumikalt commented 2 years ago

The man-page says it's from 2020-06-04, don't know if that's when it was created or last updated

owl4ce commented 2 years ago

I guess the -m flag is like GNU grep --max-count flag (?)

https://github.com/Mangeshrex/rxfetch/blob/3960865a001c82e3321f0fcc1583787b3e9953d3/rxfetch#L185

 -m NUM, --max-count=NUM
              Stop  reading  a  file  after  NUM  matching lines.  If the input is standard input from a regular file, and NUM matching lines are output, grep ensures that the
              standard input is positioned to just after the last matching line before exiting, regardless of the presence of trailing context lines.  This enables  a  calling
              process  to  resume a search.  When grep stops after NUM matching lines, it outputs any trailing context lines.  When the -c or --count option is also used, grep
              does not output a count greater than NUM.  When the -v or --invert-match option is also used, grep stops after outputting NUM non-matching lines.
owl4ce commented 2 years ago

If your distro uses procps-ng, simply remove the -m 1 flag. It should only show one process.

lumikalt commented 2 years ago

i see, ty

Mangeshrex commented 2 years ago

Is the issue fixed @lumi-kalt ?

lumikalt commented 2 years ago

Indeed. Tho I'm unsure if you can test pgrep's availability of the -m flag for everyone…

owl4ce commented 2 years ago

I suggest to use ps -e | grep -m1 -Fo instead.

https://github.com/Mangeshrex/rxfetch/blob/3960865a001c82e3321f0fcc1583787b3e9953d3/rxfetch#L185

lumikalt commented 2 years ago

Indeed, grep should work the same on all machines.