commit 05cf9d8c7b29bfba424d315a6b6d2ddca2e5d560 parent 3e01290a88f36e774c52a33ec15ce0f4016fe2ce Author: Byron Torres <b@torresjrjr> Date: Mon, 1 Feb 2021 23:47:29 +0000 Rewrite _shell() using /proc Diffstat:
M | fetch | | | 5 | ++--- |
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/fetch b/fetch @@ -55,9 +55,8 @@ _kernel() { printf "$1" "$(uname -sr)" } _shell() { - ppid=$(ps | awk "\$1 == $$ {print \$2; exit}") - path=$(ps | awk "\$1 == ${ppid} {print \$8; exit}") - printf "$1" "${path}" + shell=$(cat /proc/$(cat /proc/$$/ppid)/exename) + printf "$1" "${shell}" } _sshd() { sshd_pids=$(ps | awk 'BEGIN{ORS=" "}; /sshd/{print $1}')