title: Starting a new tmux session and detaching it, all inside a shell script
body: <p>I am trying to create a new tmux session and execute the command 'vagrant up'. 'Vagrant up' takes more than 3 hours so I want to detach the session so that I can come back later and check the status of that command by attaching back to the same session.</p>
  
  <p>I followed the answer specified in the <a href="https://stackoverflow.com/a/31903189/981183">StackOverflow post</a> to accomplish the same.</p>
  
  <p>I am getting the error <code>no session found</code>. Here is my code:</p>
  
  <pre><code>    $cat tmux_sh.sh
      #!/bin/bash
      echo "step 1"
      tmux new-session -d -s rtb123 'vagrant up'
      echo "step 2"
      tmux detach -s rtb123
  
      $./tmux_sh.sh
      step 1
      step 2
      session not found: rtb123
  </code></pre>