bin/tmuxs

Sun, 01 Jan 2017 22:57:59 -0500

author
Meredith Howard <mhoward@roomag.org>
date
Sun, 01 Jan 2017 22:57:59 -0500
changeset 465
a771fe75a85c
parent 448
12d2866f8190
child 473
049e9d356e16
permissions
-rwxr-xr-x

never used this

#!/bin/sh
set -eu

case ${1:-} in *help|-h)
  exec perldoc -T $0;;
esac

name=${1:-$(basename `pwd`)}

if tmux ls -F '#S' | grep -x $name >/dev/null; then
  if [[ ${TMUX:-} ]]; then
    exec tmux switch-client -t $name
  else
    exec tmux attach -t $name
  fi
else
  exec tmux new -s $name
fi

:<<=cut
=head1 NAME

tmuxs - Start or attach session based on cwd or given name

=head1 SYNOPSIS

 tmuxs foobaz

 cd ~/proj/quux
 tmuxs

=cut

mercurial