Thursday, February 3, 2022

[SOLVED] How to determine if .bashrc running inside VSCode terminal or not

Issue

I'd like to see if .bashrc is running inside the VSCode terminal.

I'm adding some aliases and doing some customization in my .bashhrc that I want to be applied also inside the VSCode terminal, but I don't want the last line in my script, "cd /var/myrepo," to happen because I want the terminal to stay in the current directory when opened inside VSCode.

which condition can I specify inside .bashrc to ignore some commands while running inside VSCode terminal?


Solution

Check if the variable TERM_PROGRAM equals to vscode.



Answered By - Antonio Petricca
Answer Checked By - Katrina (WPSolving Volunteer)