From c0bfd3fedf1593ca2878e53b176b625a87b7f097 Mon Sep 17 00:00:00 2001 From: sev Date: Fri, 23 Aug 2024 16:05:41 -0500 Subject: [PATCH] remove check-busybox, integrate into zshrc --- bin/.check-busybox | 4 ---- etc/zsh/.zshrc | 12 +++++------- 2 files changed, 5 insertions(+), 11 deletions(-) delete mode 100644 bin/.check-busybox diff --git a/bin/.check-busybox b/bin/.check-busybox deleted file mode 100644 index 48abb8d..0000000 --- a/bin/.check-busybox +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -function check-busybox() { - command -v "$1" >/dev/null 2>&1 && [ "busybox" = "$(basename "$(readlink -f "$(command -v "$1")")")" ] -} diff --git a/etc/zsh/.zshrc b/etc/zsh/.zshrc index da69412..21b5964 100644 --- a/etc/zsh/.zshrc +++ b/etc/zsh/.zshrc @@ -242,25 +242,23 @@ if [[ "$OSTYPE" =~ '^freebsd' ]] { } [[ -v commands[trash-put] ]] && alias t=trash-put # ps -source ~/.local/bin/.check-busybox -if [[ -v commands[pstree] ]] && ! check-busybox pstree; then +if [[ -v commands[pstree] && $commands[pstree]:A:t != busybox ]] { # use pstree, but NOT busybox pstree because it kinda sucks ps="pstree -wg3" -elif [[ "$OSTYPE" =~ '^freebsd' ]]; then +} elif [[ "$OSTYPE" =~ '^freebsd' ]] { ps="ps -aSdfxwwouser=USR -ogroup=GRP -opid,nice=NI \ -o%cpu,%mem,tty,stat,start=START -oetime,command" -elif check-busybox ps; then +} elif [[ $commands[ps]:A:t == busybox ]] { # busybox compatible ps="ps -eouser='USR ' -ogroup='GRP ' \ -opid=' PID' -onice=' NI' -ovsz=' MEM' \ -otty,stat,etime,comm" -else +} else { # XXX: untested, posix # TODO: support gnu ps ps="ps -eouser=USR -ogroup=GRP -opid,nice=NI \ -opcpu=CPU -ovsz=MEM -otty,stat,etime,comm" -fi -unfunction check-busybox +} if [[ "$(basename "$PAGER")" = "less" ]] { ps="$ps | less -S" } else { -- 2.47.0