From 0ea564f112a3eeff74ee783660049fa05d87df9c Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Fri, 13 Sep 2013 11:13:00 +0900 Subject: [PATCH] bashrc: add func dt --- bashrc | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/bashrc b/bashrc index ce59997..b20063b 100755 --- a/bashrc +++ b/bashrc @@ -397,6 +397,31 @@ man(){ man "$@" } +dt(){ + # dt [] + if test -z "$1" + then + echo "dt: usage: dt []" 1>&2 + return 1 + fi + soc_name="$1" + shift + if test -S "$soc_name" + then + dtach -a "$soc_name" + elif test -e "$soc_name" + then + echo "dt: File named $soc_name already exists." + return 1 + elif test -z "$1" + then + echo "dt: Socket named $soc_name not exists and no command specified." + return 1 + else + dtach -c "$soc_name" -e ^^ "$@" + fi +} + scr(){ test -n "$1" && pf="${1}-" local _tformat="%Y%m%d-%H%M%S%z"