0

I have found that the following command is good for creating a new screen and running a shell command in it:

screen -dmS newscreen -- sh -c 'date; exec $SHELL'

However, what if I want to run the exact same shell command, but using an existing screen? I tried the following, but when I entered the screen I saw nothing printed:

screen -S existingscreen -X -- sh -c 'date; exec $SHELL'
Mister_L
  • 2,469
  • 6
  • 30
  • 64

1 Answers1

0

That works for me, but without the double hyphens:

screen -S existingscreen -X exec sh -c 'date;exec $SHELL'
ma-ti
  • 126
  • 8