dots

Personal dotfiles
git clone git://git.gormless.xyz/dots.git
Log | Files | Refs

dm (470B)


      1 #!/bin/sh
      2 
      3 sockdir=$HOME/var/dm
      4 keyseq=
      5 
      6 list() {
      7 	tree $sockdir
      8 }
      9 
     10 usage() {
     11 	echo "`basename $0` [-hl] <alias> [command]"
     12 }
     13 
     14 test -d $sockdir || mkdir -p $sockdir
     15 
     16 while getopts "hl" opt; do
     17 	case $opt in
     18 		l) list; exit 0 ;;
     19 		h) usage; exit 0 ;;
     20 		*) usage; exit 1 ;;
     21 	esac
     22 done
     23 
     24 shift $((OPTIND - 1))
     25 
     26 case $# in
     27 	0) list; exit 0;;
     28 	1) method=a;;
     29 	*) method=A;;
     30 esac
     31 name=$1
     32 
     33 shift
     34 
     35 socket="${sockdir}/${name}"
     36 
     37 dtach -${method} ${socket} -e ${keyseq} -r winch $@