commit 3e01290a88f36e774c52a33ec15ce0f4016fe2ce
parent fd73490fd98f983b3bee990cfa03fbeba5ed1006
Author: Byron Torres <b@torresjrjr>
Date: Mon, 1 Feb 2021 01:03:24 +0000
Rewrite _shell() using its PPID from ps and awk
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fetch b/fetch
@@ -55,7 +55,9 @@ _kernel() {
printf "$1" "$(uname -sr)"
}
_shell() {
- printf "$1" "${SHELL}"
+ ppid=$(ps | awk "\$1 == $$ {print \$2; exit}")
+ path=$(ps | awk "\$1 == ${ppid} {print \$8; exit}")
+ printf "$1" "${path}"
}
_sshd() {
sshd_pids=$(ps | awk 'BEGIN{ORS=" "}; /sshd/{print $1}')