title: zsh / bash - How to write directories of all open terminal tabs to file?
body: <p>I would like to write the working directory of every terminal tab to a single file. I think I've come close with the following, but the problem is that the same (current) directory path is written to the file multiple times.</p>
  
  <pre><code>for x in $(ps | grep zsh)
  do
    echo "$(pwd)" &gt;&gt; "tabs open $(date +%Y_%m_%d_%H_%M_%S).txt"
  done
  </code></pre>
  
  <p>Thanks in advance for putting up with my newbish question.</p>