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'm running such script to transcode my audio files:

#!/bin/bash
acodec="vorb"  
arate="256" 
ext="ogg" 
vlc="/usr/bin/vlc" 
fmt="mp3" 

for a in *$fmt; do 
$vlc -I dummy -vvv "$a" --sout "#transcode{acodec=$acodec,ab=$arate,channels=2}:duplicate{dst=std{access=file,mux=ogg,dst=\"$a.$ext\"}" vlc://quit 
done

And trying to redirect this script output to file like this:

./transcode.sh > /media/sf_Downloads/transcode.log

But receive only 0 byte file. Why?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

VLC is writing to stderr and not stdout. You can mend this in your log redirection by calling the script like:

./transcode.sh > /media/sf_Downloads/transcode.log 2>&1

or in the Bash specific way:

./transcode.sh &> /media/sf_Downloads/transcode.log

You can also do the redirection to stdout within the script by adding 2>&1 at the end of the line with the VLC command within the loop. Then you can call the script just as you tried before:

./transcode.sh > /media/sf_Downloads/transcode.log

and get the intended logging result directly.

For more information, see e.g.

share|improve this answer
    
Thanks, it helped! –  Dezmond Mar 12 at 17:23

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.