Search code examples
shellintellij-ideazshtmux

Prevent TMUX from starting in intellij terminal


So I have the following snippet:

if [[ ps -p$PPID | grep 'java' == '' ]]; then
    ZSH_TMUX_AUTOSTART=true;
fi

which returns the following error:

/home/otis/.zshrc:8: parse error: condition expected: ps

The idea is that if ps -p$PPID | grep 'java' returns nothing then set ZSH_TMUX_AUTOSTART=true.

The reason I want to do this is I want to automagically start tmux in my gnome-terminal but not in my intellij terminal if I run this command in gnome it returns nothing and if I run from intellij it returns java.

So the logic is solid basically if there is nothing returned always start tmux, but I am not that good at shell so any help would be much appreciated.

Cheers.


Solution

  • I realize this is an old thread and the TERMINAL_EMULATOR variable may not have been the same at the time of the original post but I solved this on OSX with the following:

    if [ "$TERMINAL_EMULATOR" != "JetBrains-JediTerm"]
    then 
       ZSH_TMUX_AUTOSTART=true
    fi