#!/bin/sh test -n "$1" || { echo "usage: tab " echo -e "\ntabs: " find /tmp/*.dtach | xargs -n1 basename | sed 's/\.dtach//g' exit 0; } # attach to a sessions [or create if it does not exist] dtach -r ctrl_l -A /tmp/$1.dtach