GNU Screen and.bashrc

I am attempting to release GNU Screen utilizing my .bashrc. I'm virtually there:

if [ -z "$STY" ]; then
   exec screen -dR
else
   exec gnome-terminal
fi

This is incorrect though! The first instance functions, screen launches when I open a terminal. Yet the 2nd component falls short. I intend to open a normal terminal if I currently have one open. Yet this simply opens up a boundless variety of terminals ...

0
2019-05-07 09:04:57
Source Share
Answers: 2

You can attempt (after the else):

if [ "$HAS_STARTED_TERM"!="1"]; then
    HAS_STARTED_TERM=1
    export HAS_STARTED_TERM
    exec gnome-terminal
fi
0
2019-05-09 02:41:16
Source

If I'm not incorrect, the terminal would certainly open generally if you simply remove the "else" block ... Or possibly I'm missing out on something.

0
2019-05-09 02:33:08
Source