From 3c1b991bc2fe892a922ff4fc99bfd568927e7238 Mon Sep 17 00:00:00 2001 From: GaugeK Date: Sun, 9 Aug 2020 05:33:19 +1000 Subject: [PATCH] Change method of printing any argument given, less hard-coded --- fet.sh | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/fet.sh b/fet.sh index f351c81..50e6601 100755 --- a/fet.sh +++ b/fet.sh @@ -24,18 +24,20 @@ while [ ! "$term" ]; do ppid=$(ppid "$ppid") done -## WM -# requires the WM to include 'wm' or 'monad' (for you leon) +## WM/DE pg() { + unset ab var # i hate myself for this - [ $# = 1 ] && set -- $1 $1 $1 $1 $1 - ab= + for i in "$@"; do + var="${var:+$var|}*$i*" + done for i in /proc/[0-9]*; do ab="$ab ${i##*/}" read -r a < "$i"/comm - case $a in - *$1*|*$2*|*$3*|*$4*|*$5*) echo "$a" "${i##*/}"; break;; - esac + # this was sadly the better option... + eval "case \$a in + $var) echo \"\$a\" \"\${i##*/}\"; break;; + esac" done }