Monday 15 July 2013

shell - Create a session in the background if it doesn't exist but do not attach in tmux -



shell - Create a session in the background if it doesn't exist but do not attach in tmux -

i've looked @ this similar question asks creating tmux session, or attaching if doesn't exist.

what i'd little different: create tmux session if doesn't exist, don't attach. plan create few different sessions canonical names, send commands them using tmux send. there easy way in tmux or shell scripting create session specific name if doesn't exist?

if seek create session same name tmux returns error exit code 1.

drizzt@liara ~ % tmux new-session -d -s test drizzt@liara ~ % tmux new-session -d -s test duplicate session: test drizzt@liara ~ % echo $? 1 drizzt@liara ~ %

if don't duplicate session error can like:

drizzt@liara ~ % tmux has-session -t test || tmux new-session -d -s test

shell tmux

No comments:

Post a Comment