mirror of
https://github.com/eepykate/fet.sh.git
synced 2026-11-19 19:40:46 +00:00
Sane function name for [ a = b ] with globbing clone
This commit is contained in:
1 parent
5dd087585c
commit
293b388623
1 file changed
+5
-5
@@ -7,7 +7,7 @@
|
|||||||
# supress errors
|
# supress errors
|
||||||
exec 2>/dev/null
|
exec 2>/dev/null
|
||||||
set --
|
set --
|
||||||
_() { # [ a = b ] with globbing
|
eq() { # equals | [ a = b ] with globbing
|
||||||
case $1 in
|
case $1 in
|
||||||
$2) return
|
$2) return
|
||||||
esac;! :
|
esac;! :
|
||||||
@@ -31,7 +31,7 @@ if [ -e /proc/$$/comm ]; then
|
|||||||
# loop over lines in /proc/pid/status until it reaches PPid
|
# loop over lines in /proc/pid/status until it reaches PPid
|
||||||
# then save that to a variable and exit the file
|
# then save that to a variable and exit the file
|
||||||
while read -r line; do
|
while read -r line; do
|
||||||
_ "$line" "PPid*" && ppid=${line##*:?} && break
|
eq "$line" "PPid*" && ppid=${line##*:?} && break
|
||||||
done < "/proc/${ppid:-$PPID}/status"
|
done < "/proc/${ppid:-$PPID}/status"
|
||||||
|
|
||||||
# get name of binary
|
# get name of binary
|
||||||
@@ -59,7 +59,7 @@ if [ -e /proc/$$/comm ]; then
|
|||||||
# loop over lines in /proc/meminfo until it reaches MemTotal,
|
# loop over lines in /proc/meminfo until it reaches MemTotal,
|
||||||
# then convert the amount (second word) from KB to MB
|
# then convert the amount (second word) from KB to MB
|
||||||
while read -r line; do
|
while read -r line; do
|
||||||
_ "$line" "MemTotal*" && set -- $line && break
|
eq "$line" "MemTotal*" && set -- $line && break
|
||||||
done < /proc/meminfo
|
done < /proc/meminfo
|
||||||
mem="$(( $2 / 1000 ))MB"
|
mem="$(( $2 / 1000 ))MB"
|
||||||
|
|
||||||
@@ -81,7 +81,7 @@ if [ -e /proc/$$/comm ]; then
|
|||||||
## Kernel
|
## Kernel
|
||||||
read -r _ _ version _ < /proc/version
|
read -r _ _ version _ < /proc/version
|
||||||
kernel="${version%%-*}"
|
kernel="${version%%-*}"
|
||||||
_ "$version" "*Microsoft*" && ID="fake $ID"
|
eq "$version" "*Microsoft*" && ID="fake $ID"
|
||||||
|
|
||||||
## Motherboard // laptop
|
## Motherboard // laptop
|
||||||
read -r model < /sys/devices/virtual/dmi/id/product_name
|
read -r model < /sys/devices/virtual/dmi/id/product_name
|
||||||
@@ -196,7 +196,7 @@ fi
|
|||||||
|
|
||||||
## GTK
|
## GTK
|
||||||
while read -r line; do
|
while read -r line; do
|
||||||
_ "$line" "gtk-theme*" && gtk="${line##*=}" && break
|
eq "$line" "gtk-theme*" && gtk="${line##*=}" && break
|
||||||
done < "${XDG_CONFIG_HOME:=$HOME/.config}/gtk-3.0/settings.ini"
|
done < "${XDG_CONFIG_HOME:=$HOME/.config}/gtk-3.0/settings.ini"
|
||||||
|
|
||||||
# Shorten $cpu and $vendor
|
# Shorten $cpu and $vendor
|
||||||
|
|||||||
Reference in new issue
Block a user