Hacker News new | ask | show | jobs
by kelnos 697 days ago
That forks twice for every iteration of the loop, though: once for the subshell, and again to run `tr`.
1 comments

Fix:

  ps() { for i in /proc/[0-9]*; do readarray -d '' -t cmdline < "$i/cmdline"; printf "%s: %s\n" "${i#/proc/}" "${cmdline[*]}"; done; }