0

I was wondering if there is a way to make screen display a message to a user when they attach to a screen session? For instance, if it is preferred that a user does not use a shared screen session for their personal activities "Please do not use this session for personal activities" could be displayed when the user attaches to the screen. I have tried putting an echo command in my screenrc file, but it did not result in anything being displayed (see below).

enter image description here

Thanks for your help, it is much appreciated!

1 Answer 1

0

Well, that's not the way echo works, but there are at least two ways to show mot-style notifications under screen:

  • Screen will set $TERM to "screen", so you can check its value in the shell startup file, e.g. ~/.bashrc (or /etc/bashrc)
  if [ "x$TERM" == "xscreen" ];
          echo "Please do not use this session for personal activities"
  fi
  • If you really want to drive your users crazy, you can use screen's hstatus (or caption, see man) to display a nag message in the bottom line of every screen window, but this won't work if your power-users are using the status line for something else. In ~/.screenrc (or /etc/screenrc) write:
hardstatus on
hardstatus lastline
defhstatus "Please do not use this session for personal activities"

or alternatively

caption always
caption string "Please do not use this session for personal activities"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .