Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I disable the output when you are done with a screen from the screen command?


function foo()
    echo "Testing..."
    sleep 2
    echo "Done!"
export -f foo
screen -q bash -c "foo" &> /dev/null

It all works as expected, however I cannot find out how to disable the "[screen is terminating]".

share|improve this question
Screen runs detached from your terminal, so you can't use the pipe like you would expect, this won't work for example: screen -q bash -c "foo" | head -n -1 &> /dev/null. So the real question is why do you care about this one line of text? If you can answer that, then maybe we can find a solution to that problem. – totaam Dec 31 '11 at 19:28
up vote 2 down vote accepted

There are only two solutions that I can think of. The first is to modify the screen code itself and recompile. The second is to have something like an expect wrapper around the program (untested):

#!/usr/bin/expect -f
spawn screen -q bash -c foo
interact {
    "\[screen is terminating]" exit
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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