scripts

various script and utils
git clone git://z3bra.org/scripts
Log | Files | Refs

commit dd74860608c08f879da4870f18f36e9d01f91670
parent 59371792f34fc43b6ddb004ee23b1b7c780090c8
Author: z3bra <willy@mailoo.org>
Date:   Fri Apr  4 16:14:13 +0200

dtach sessions manager

Diffstat:
dm | 37+++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+), 0 deletions(-)
diff --git a/dm b/dm @@ -0,0 +1,37 @@ +#!/bin/sh +# +# z3bra - (c) wtfpl 2014 +# Create/list/attach/detach applications using dtach + +sockdir=~/var/run + +list() { + ls -1 $sockdir --color=auto +} + +usage() { + echo "`basename $0` [-hl] <alias> [command]" +} + +while getopts "l" opt; do + case $opt in + l) list; exit 0 ;; + h) usage; exit 0 ;; + *) usage; exit 1 ;; + esac +done + +shift $((OPTIND - 1)) + +case $# in + 0) usage; exit 1;; + 1) method=a;; + *) method=A;; +esac +name=$1 + +shift + +socket="${sockdir}/${name}" + +dtach -${method} ${socket} -r winch $@