1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2024-07-01 11:17:12 -07:00
rc/sh/screeny

24 lines
546 B
Plaintext
Raw Normal View History

2015-12-06 12:35:57 -08:00
#!/usr/bin/env zsh
2021-07-29 00:37:35 -07:00
# YES_ZSH
2021-09-23 06:48:05 -07:00
# YES_BASH
# NO_DASH
# NO_ASH
2015-12-06 12:35:57 -08:00
2021-07-30 17:57:08 -07:00
screeny() { ### @-
### handle GNU screens.
### these days, i typically use tmux instead.
2015-12-06 12:35:57 -08:00
local user="${1:?needs arg for user name}"
shift
home="/home/$user"
pushd "$home" >/dev/null
local name="${1:?needs arg for screen name}"
shift
2016-01-05 05:38:34 -08:00
~/sh/unscreen "$name" || return 1
echo screen -S "$name" -dm sudo -Hu "$user" "$@"
2015-12-06 12:35:57 -08:00
screen -S "$name" -dm sudo -Hu "$user" "$@"
popd "$home" >/dev/null
2016-01-05 05:38:34 -08:00
return 0
2015-12-06 12:35:57 -08:00
}
[ -n "${preload+-}" ] || screeny "$@"