Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • 1
    Just to make sure I understand the question correctly: you’re in a shell inside a tmux session, and you want to change that session "working directory" so that new windows will have the same working directory as the location where you’re running the script? Commented Nov 17, 2020 at 21:05
  • Correct. Or a directory passed as an argument, but defaulting to the working directory of the script. Commented Nov 17, 2020 at 21:08
  • As a workaround (not sure if the direct way is feasible, I didn’t see how so far), would a solution like this be good for you? - in your script, do tmux update-environment -t . MY_WORKING_DIRECTORY /path/to/directory - At the end of your fish/bash/whatever initialisation script, if [ -n "$MY_WORKING_DIRECTORY" ]; then cd "$MY_WORKING_DIRECTORY"; fi (bash syntax, I don’t know fish at all) Commented Nov 17, 2020 at 21:24