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.

I want to run two executables in the foreground by typing one line of code or running a shell script. These executables watch a directory and recompile some code while outputting their status to stdout.

I want the stdout to be presented in the same way as following two files in 'tail' like so:

tail -f foo.txt -f bar.txt

==> foo.txt <==
Something

==> bar.txt <==
Something else

When something changes it prints the filename before printing the output. It only prints the filename when it needs to indicate that the output is coming from the other file.

share|improve this question
4  
You haven't actually asked a question. I'm not trying to be rude, but I honestly don't know what your question is after reading that. –  Daniel Andersson Jun 12 '12 at 6:45
    
Sorry about that. I've added some more detail. –  vaughan Jun 13 '12 at 1:40

2 Answers 2

Since the two executables write to standard output, you may be able to just tail the files produced by process substitution:

tail -f <( executable_one ) <( executable_two )

(Only one -f needed, by the way. It's a global option, not something you need to specify for each file.)

Each of the two executables runs separately, and its output is captured and redirected to a file handle which is passed tail. In the output, the file names will appear as something like "/dev/fd/63". Unfortunately, I don't know of a way to get tail to use an alternate name (like with grep and the --label option).

share|improve this answer

See this Geek Stuff article: "3 Methods To View tail -f output of Multiple Log Files in One Terminal".

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.