0

In general, I have long simulations running on several screen sessions which can get confusing.

Is there a way to get the directory on which one specific screen session is on?

EDIT: I just realized that the easiest thing to do is just to launch the job in the background... Nevertheless, my question still stands.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
solalito
  • 1,189
  • 4
  • 19
  • 34

1 Answers1

0

You can send a command to screen, e.g., a shell script could do something like this (assuming the session is named MySession):

#!/bin/sh
myfile=$(mktemp)
screen -S MySession sh -c 'pwd >$myfile'
cat $myfile
rm -f $myfile

That seems to work only for the first window opened in a screen session (rather than for the currently active one).

Thomas Dickey
  • 51,086
  • 7
  • 70
  • 105