Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there a way wherein we can start a screen, execute a command and detach it without actually entering into the screen? something like

screen -[some option] [command tobe executed]

I need this because i have about 100 files that each have different input files and i need to run each on a screen and if the above is possible all i need to do is create a shell script..

Is there an option in screen that would let me do this?

share|improve this question

migrated from stackoverflow.com May 20 '11 at 3:11

This question came from our site for professional and enthusiast programmers.

2 Answers 2

up vote 1 down vote accepted

You can run screen in detached mode by using the -d -m option, eg.

screen -d -m some_cmd
share|improve this answer
    
thanks.. but what if i want to redirect the output to a file? like screen -d -m sudo ./mycode &>output but this just gives a blank file and the output is actually displayed inside the screen.. –  Prasanth Madhavan May 20 '11 at 7:28

Try tmux (http://tmux.sourceforge.net/). It is much more suited to be used in this manner. Screen is optimized for interactive usage.

share|improve this answer

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.