Visual Studio Code Remote fish/tcsh/csh Shells Hotfix

Yilin (Jim) Shi
1 min readOct 5, 2020

--

As you may have found, changing your remote’s default shell to fish/ tcsh/ csh may break its compatibility with the VSCode Remote plugin. Here's a quick fix for that:

  1. Change your default shell to bash: chsh -s /bin/bash
  2. At the end of your remote’s ~/.bashrc file, add:
# Execute `fish` in interactive modeif [ -z "$PS1" ]; then    echo 'This shell is not interactive. Will keep using bash to make VS Code Remote work.'else    echo 'This shell is interactive. Will switch to fish.'    exec fishfi

The reasoning behind this: PS1 is unset in non-interactive shells (e.g. VSCode remote).

Update May 2021

An alternative that should also work:

if [[ "$-" == *"i"* ]]; then
exec fish
fi

The reasoning behind this: The $- variable contains the current shell's options while -i means "interactive".

Imported from draft at: https://www.sfu.ca.

--

--