When you start tmux the terminal emulator starts in your home directory. How to change the directory at startup?
For example, with cd ~/myprojects/test_project && tmux terminal starts at ~ and would like in test_project .
UPD:
Judging by the context matters. tmux i run under cygwin , mintty . As shell: zsh . To start trying to give birth to the script:
#!/bin/sh export WORKDIR='/cygdrive/d/work/' PROJECT_DIR='cm' PROJECT_NAME='cm' PS3='Please enter your choice: ' options=("New session" "Quit") select opt in "${options[@]}" do case $opt in "New session") cd $WORKDIR if [ ! -d $PROJECT_DIR ] ; then mkdir -p $PROJECT_DIR fi cd $PROJECT_DIR tmux has-session -t $PROJECT_NAME 2>/dev/null if [ "$?" -eq 1 ] ; then echo "no session found. configuring..." tmux new-session -d -s $PROJECT_NAME #configuring windows tmux rename-window 'cm' tmux split-window -v tmux send-keys "cmd.exe" Cm tmux select-pane -t 1 tmux resize-pane -D 20 tmux send-keys "vim" Cm tmux select-window -t $PROJECT_NAME:1 else echo 'session found. connecting ...' fi tmux attach-session -t $PROJECT_NAME break ;; "Quit") break ;; *) echo invalid option;; esac done go to the right directory
cd $WORKDIR if [ ! -d $PROJECT_DIR ] ; then mkdir -p $PROJECT_DIR fi cd $PROJECT_DIR is performed because echo $PWD shows the correct path.
just go to the correct directory and launch a new tmux session starts the shell in ~ .