Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

Example:

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
1  
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
add comment

1 Answer

up vote 1 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
add comment

Your Answer

 
discard

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.