commit 015c94bcd508cd0fa74ed9eb6dfcd8d60a447e68 parent 9281b99ec4767c197e7ed92fd65e2c661dc6172d Author: Byron Torres <b@torresjrjr.com> Date: Mon, 21 Jun 2021 23:54:32 +0100 Use ps formatting to simplify 0b0e927 & 81812e8 Diffstat:
M | fetch | | | 8 | +++++--- |
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/fetch b/fetch @@ -59,13 +59,15 @@ _shell() { printf "$1" "$(readlink /proc/$PPID/exe)" } _sshd() { - pids=$(ps ax | awk '!/awk/ && /sshd/ {printf $1 " "}') + pids=$(ps axc -o 'pid,cmd' | awk '/sshd/{printf $1 " "}') printf "$1" "${pids:---}" } _tmux() { - ps ax | grep -v 'grep' | grep -q 'tmux' && tmux_sessions=$( + ps axc -o 'cmd' | grep -q 'tmux: server' && tmux_sessions=$( tmux ls -F "#{session_created} #{?session_attached,$ul,}#S:#{session_windows}$c0" \ - | sort | awk '{printf $2 " "}' | xargs -0 printf + | sort \ + | awk '{printf $2 " "}' \ + | xargs -0 printf ) printf "$1" "${tmux_sessions:---}" }