1

In qsub Oracle Grid Engine, this redirects the output to a file out.txt,

qsub -o $(pwd)/out.txt -sync y awesome_script.sh

How to redirect the output to stdout ?

0

1 Answer 1

4

You can specify /dev/stdout as the filename.

qsub -o /dev/stdout -sync y awesome_script.sh

More info can be found in this answer: https://unix.stackexchange.com/questions/36403


Edit:

A common Unix idiom is that the filename - means stdin for an input file and stdout for an output file. This has to be explicitly handled by the program, though; it's not automatic. I can't find anything saying whether qsub uses this idiom. Try it, it might work.

If you want to pipe the output to another command that does something with it, you could create a named pipe (man mkfifo) and send the output to that, with the other process reading from the pipe. Start the read process first.

For another idea, see this answer, which explains how to use bash process substitution. I haven't used this much, but I think it would be something like:

qsub -o >(other-command-or-pipeline) -sync y awesome_script.sh

If you simply want to see the output in real-time, you could specify /dev/tty as the file. Or, you could output to a file and watch it with tail -f.

Hope one of these ideas works for you.

Sign up to request clarification or add additional context in comments.

6 Comments

Many Thanks for your response. It seems this approach does not function with qsub though.
@elm: How is it failing? Is /dev/stdout not there? How about /dev/fd? What OS?
Program somehow stalls, no cpu loads, no I/O, no files transformed. Using Centos 6. May the issue be at redirecting remote /dev/stdout to master /dev/stdout ?
Any help appreciated. +1 for devising proposed solution which works in most cases.
Hi @elm, looks like some of that was useful. Since other people may encounter a similar problem, please consider editing your question or leaving a comment, to let them know which approach worked best for you.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.