fetch

MSYS2-compatible system info prompt
git clone https://git.torresjrjr.com/fetch.git
Log | Files | Refs | README | LICENSE

commit 5d20b4a9ac4868f8b56270f0c654932d274cc79f
parent abf538d96e38fb5f6e6007c61e86e3513788439a
Author: Byron Torres <b@torresjrjr.com>
Date:   Fri, 20 Aug 2021 13:07:16 +0100

Revert 015c94b "Use ps formatting to simplify..."

This reverts commit 015c94bcd508cd0fa74ed9eb6dfcd8d60a447e68.

The ps -c flag was not portable on MSYS2.

Note: BSD-style flags also don't work on MSYS2, but fall back gracefully
instead. Default MSYS2 ps lists all MSYS2 proccesses anyway.

Diffstat:
Mfetch | 8+++-----
1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/fetch b/fetch @@ -56,15 +56,13 @@ _shell() { printf "$1" "$(readlink /proc/$PPID/exe)" } _sshd() { - pids=$(ps axc -o 'pid,comm' | awk '/sshd/{printf $1 " "}') + pids=$(ps ax | awk '!/awk/ && /sshd/ {printf $1 " "}') printf "$1" "${pids:---}" } _tmux() { - ps axc -o 'comm' | grep -q 'tmux: server' && tmux_sessions=$( + ps ax | grep -v 'grep' | grep -q 'tmux' && 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:---}" }