Change method of printing any argument given, less hard-coded

This commit is contained in:
GaugeK committed 2020-08-09 05:33:36 +10:00
1 parent 7e43f12610
commit 3c1b991bc2
1 file changed
+9 -7
+9 -7
View File
@@ -24,18 +24,20 @@ while [ ! "$term" ]; do
ppid=$(ppid "$ppid") ppid=$(ppid "$ppid")
done done
## WM ## WM/DE
# requires the WM to include 'wm' or 'monad' (for you leon)
pg() { pg() {
unset ab var
# i hate myself for this # i hate myself for this
[ $# = 1 ] && set -- $1 $1 $1 $1 $1 for i in "$@"; do
ab= var="${var:+$var|}*$i*"
done
for i in /proc/[0-9]*; do for i in /proc/[0-9]*; do
ab="$ab ${i##*/}" ab="$ab ${i##*/}"
read -r a < "$i"/comm read -r a < "$i"/comm
case $a in # this was sadly the better option...
*$1*|*$2*|*$3*|*$4*|*$5*) echo "$a" "${i##*/}"; break;; eval "case \$a in
esac $var) echo \"\$a\" \"\${i##*/}\"; break;;
esac"
done done
} }