2015-12-06 12:35:57 -08:00
|
|
|
#!/usr/bin/env zsh
|
2021-07-29 00:37:35 -07:00
|
|
|
# YES_ZSH
|
2021-07-29 05:44:12 -07:00
|
|
|
# NO_BASH
|
|
|
|
# NO_DASH
|
2021-09-23 06:48:05 -07:00
|
|
|
# NO_ASH
|
2015-12-06 12:35:57 -08:00
|
|
|
|
2021-07-30 17:57:08 -07:00
|
|
|
unscreen() { ### @-
|
2021-08-02 06:06:13 -07:00
|
|
|
### handle closing of screens — this works alongside [`screeny`](#screeny).
|
|
|
|
### these days, i typically use tmux instead.
|
2015-12-06 12:35:57 -08:00
|
|
|
local pids="$(screen -ls | fgrep "$1" | cut -d. -f1)"
|
|
|
|
for pid in $=pids; do
|
|
|
|
local ppid="$(ps h --ppid "$pid" -o pid)"
|
2016-04-08 12:01:54 -07:00
|
|
|
kill $=ppid || return 1
|
2015-12-06 12:35:57 -08:00
|
|
|
done
|
2016-01-05 05:38:34 -08:00
|
|
|
return 0
|
2015-12-06 12:35:57 -08:00
|
|
|
}
|
|
|
|
|
2021-08-02 13:48:46 -07:00
|
|
|
[ -n "${preload+-}" ] || unscreen "$@"
|