5 ms·
He should really use awk instead of cut. or killall and for awesomeness, he should use zsh. bash is what you use for mediocrity.
by ilyak 17y ago
He should really use awk instead of cut.
or killall
and for awesomeness, he should use zsh.
bash is what you use for mediocrity.
- xelfer 17y agoWhy awk instead of cut?
- ajross 17y agoWho modded that down? He really should be using awk instead of cut. It has better readability: "{print $2}" to print the second field vs. a set of magic numbers denoting a character field. It's vastly easier to write (again, the "second field" is intuitive). It's also more generally useful, meaning that it's a better tool to know; cut is very primitive. That said, there are better ways still to solve this problem. Some of them were detailed above. One that wasn't was the fact that GNU ps has lots of filtering options itself, in this case: ps -eo pid -U 1002 Does the work of the grep and cut from the original for you.