Is it possible to run source ~/.bashrc once but for all my N shell sessions (I'm talking about sessions related to one gnu screen of course) ?

Same question but for things like export TEST_VAR=whatever in one shell sessions.

  • 2
    When you say Windows, do you mean terminal sessions? – Raman Sailopal Sep 21 '17 at 12:38
  • 2
    @RamanSailopal The question is tagged gnu-screen, so I presume it's related to windows within a screen session. – Kusalananda Sep 21 '17 at 12:43
  • 1
    How do you usually start your screen sessions? The sessions would inherit the environment variables from the calling shell. – Kusalananda Sep 21 '17 at 12:45
  • @Kusalananda I just run screen – smarber Sep 21 '17 at 12:59

If I understand your question correctly, you have N shell sessions in one GNU screen and you want to execute a given shell command (such as source ~/.bashrc or export TEST_VAR=whatever) in all shell sessions at once.

This can be done from inside your screen session with:

Ctrl-A:at "#" stuff "export TEST_VAR='whatever'\n"

This can be done from anywhere with:

screen -X at "#" stuff "export TEST_VAR='whatever'\n"

(you may want to specify a particular screen session with the -S option)

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.