diff --git a/TerminalDocs/tutorials/new-tab-same-directory.md b/TerminalDocs/tutorials/new-tab-same-directory.md index 00a87105..a210731e 100644 --- a/TerminalDocs/tutorials/new-tab-same-directory.md +++ b/TerminalDocs/tutorials/new-tab-same-directory.md @@ -110,14 +110,17 @@ Windows Subsystem for Linux distributions primarily use BASH as the command line #### `bash` -Add the following line to the end of your `.bash_profile` config file: +Add the following line to the end of your `.bashrc` config file: ```bash -PROMPT_COMMAND=${PROMPT_COMMAND:+"$PROMPT_COMMAND ; "}'printf "\e]9;9;%s\e\\" "$(wslpath -w "$PWD")"' +PROMPT_COMMAND=${PROMPT_COMMAND:+"$PROMPT_COMMAND; "}'printf "\e]9;9;%s\e\\" "$(wslpath -w "$PWD")"' ``` The `PROMPT_COMMAND` variable in bash tells bash what command to run before displaying the prompt. The `printf` statement is what we're using to append the sequence for setting the working directory with the Terminal. The `$(wslpath -w "$PWD")` bit will invoke the `wslpath` executable to convert the current directory into its Windows-like path. The `${PROMPT_COMMAND:+"$PROMPT_COMMAND; "}` bit is [some bash magic](https://unix.stackexchange.com/a/466100) to make sure we append this command to any existing command (if you've already set `PROMPT_COMMAND` somewhere else.) +> [!NOTE] +> We recommend using `.bashrc` rather than `.bash_profile` because most terminal sessions (including new tabs and panes in Windows Terminal) start as non-login shells, which only read `.bashrc`. If you need this to work in login shells as well, you can add the same line to `.bash_profile`, or have `.bash_profile` source `.bashrc`. + #### `zsh` Add the following lines to the end of your `.zshrc` file: