1

I'm writing a script that spawns a screen process but depends on some pre-conditions I intend to perform before attaching to it.

I noticed that when started in detached mode it does not recognize the $TERM, but I do not want to hardcode it on .screenrc, and I did not find anyone with the same problem.

Here's my environment:

$ screen --version
Screen version 4.06.02 (GNU) 23-Oct-17
$ echo $TERM
xterm-256color

Here you can see it works as expected:

$ screen -ADRS profile
$ echo $TERM
screen.xterm-256color

But if done this way it goes all wrong:

$ screen -dmS profile
# I will perform some stuff here, then:
$ screen -ADrS profile
# here you can notice the colors have gone
$ echo $TERM
screen

How can I spawn a detached screen but get the same $TERM behavior as it was in the first case, without hardcoding the term on .screenrc?

  • These look like the solution to your problem - stackoverflow.com/questions/19799395/…. – slm Jul 13 '18 at 18:51
  • @slm I see that is a similar question, if there was an acceptable answer it could help me, but unfortunately none of that is applicable to solve the problem. – Tiago Pimenta Jul 14 '18 at 19:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.