commit 14449d4
hovercats
·
2024-11-26 23:19:25 +0000 UTC
parent 65c4c0e
sh/dm: import dm from z3bra, as it seems to be borked when written in rc. need to investiage this more later..
1 files changed,
+41,
-0
A
sh/dm
A
sh/dm
+41,
-0
1@@ -0,0 +1,41 @@
2+#!/bin/sh
3+#
4+# z3bra - (c) wtfpl 2014
5+# Create/list/attach/detach applications using dtach
6+
7+sockdir=/tmp/dm
8+keyseq=
9+
10+list() {
11+ # change colors, for fun!
12+ ls -1 $sockdir
13+}
14+
15+usage() {
16+ echo "`basename $0` [-hl] <alias> [command]"
17+}
18+
19+test -d $sockdir || mkdir -p $sockdir
20+
21+while getopts "hl" opt; do
22+ case $opt in
23+ l) list; exit 0 ;;
24+ h) usage; exit 0 ;;
25+ *) usage; exit 1 ;;
26+ esac
27+done
28+
29+shift $((OPTIND - 1))
30+
31+case $# in
32+ 0) list; exit 0;;
33+ 1) method=a;;
34+ *) method=A;;
35+esac
36+name=$1
37+
38+shift
39+
40+socket="${sockdir}/${name}"
41+
42+dtach -${method} ${socket} -e ${keyseq} -r winch $@