mirror of
https://github.com/eepykate/fet.sh.git
synced 2026-11-08 16:11:07 +00:00
1 file changed
+7
-12
@@ -9,25 +9,20 @@ exec 2>/dev/null
|
|||||||
set --
|
set --
|
||||||
|
|
||||||
## Terminal
|
## Terminal
|
||||||
ppid() {
|
|
||||||
while read -r line; do
|
|
||||||
case $line in
|
|
||||||
PPid*) echo "${line##*:?}"; break;;
|
|
||||||
esac
|
|
||||||
done < /proc/"$1"/status
|
|
||||||
}
|
|
||||||
|
|
||||||
while [ ! "$term" ]; do
|
while [ ! "$term" ]; do
|
||||||
read -r name < "/proc/${ppid:=$$}/comm"
|
while IFS=': ' read -r key val; do
|
||||||
|
case $key in
|
||||||
|
PPid) ppid=$val; break;;
|
||||||
|
esac
|
||||||
|
done < "/proc/${ppid:-$PPID}/status"
|
||||||
|
|
||||||
|
read -r name < "/proc/$ppid/comm"
|
||||||
case $name in
|
case $name in
|
||||||
*sh) ;;
|
*sh) ;;
|
||||||
"${0##*/}") ;;
|
"${0##*/}") ;;
|
||||||
*[Ll]ogin*|*init*) term=linux;;
|
*[Ll]ogin*|*init*) term=linux;;
|
||||||
*) term="$name";;
|
*) term="$name";;
|
||||||
esac
|
esac
|
||||||
o="$ppid"
|
|
||||||
ppid=$(ppid "$ppid")
|
|
||||||
[ "$o" = "$ppid" ] && break
|
|
||||||
done
|
done
|
||||||
|
|
||||||
## WM/DE
|
## WM/DE
|
||||||
|
|||||||
Reference in new issue
Block a user