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 am using an application which requires aoss. The results are required to be appended to a file. When I write these commands, the file is always empty:

aoss multimon -a DTMF | tee test.txt
aoss multimon -a DTMF > test.txt
aoss multimon -a DTMF >> test.txt

I believe the problem is that the file logging is pointing to aoss, rather than multimon -a DTMF, because the latter is actually an argument to the first. Is there a way to log the argument command instead, and yet still make the application runnable? (multimon -a DTMF is a terminal command using an application called multimon for DTMF decoding)

Thanks!

(Am I asking this question in the right place?)

share|improve this question

2 Answers 2

You could put the entire multimon command into a shell script and run that with aoss, or start another shell inside aoss:

(shell 1) $ aoss bash
(shell 2) $ multimon -a DTMF > test.txt
(shell 2) $ exit
(shell 1) $
share|improve this answer
    
Neither of them worked sadly. This is what I wrote in the script: #!/bin/sh multimon -a DTMF > test.txt exit # END –  Ahmed Farid Apr 9 '13 at 19:16

The way aoss (a very short shell script) works is by preloading a special library using LD_PRELOAD. You can set this variable manually as well:

export LD_PRELOAD='/usr/$LIB/libaoss.so'
multimon --etc --etc --etc > test.txt

I believe the problem is that the file logging is pointing to aoss, rather than multimon -a DTMF, because the latter is actually an argument to the first.

That's not the cause. When process X opens or closes files (e.g. sets up redirection) and starts process Y, then the new process inherits the newly opened files. In other words, the shell just sets up redirection and runs the given aoss multimon... command, which inherits the redirected output from the shell. Likewise, when aoss does its thing and finally runs multimon -a DTMF, the multimon process inherits the same redirections from aoss.

share|improve this answer
    
I was indeed looking for a similar solution to yours! However, export LD_PRELOAD='/usr/$LIB/libaoss.so' doesn't seem to fix the problem, as multimon -a DTMF still wouldn't work without aoss. I'm getting open: No such file or directory –  Ahmed Farid Apr 9 '13 at 19:56
    
@AhmedFarid: Then read the aoss script and check what it does differently. –  grawity Apr 9 '13 at 19:57

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.