Hacker News new | ask | show | jobs
by artemave 734 days ago
I have a better version (in the sense that it automatically names sessions after the current directory):

  if [ -z "$1" ]; then
    name="$(basename $PWD)"
    name="${name//\./-}"
  else
    name=$1
  fi

  tmux has -t "=$name" && tmux attach -t "$name" && exit

  tmux new-session -d -s "$name" -n shell
1 comments

Better is subjective. This version has no way to easily list sessions. Depends on what you want :)