mardi 3 août 2021

Condition to check if a command printed something to stdout

I am trying to create a loop that will return pass or fail if something is printed to stdout using the command below. The command will print info to the screen if a video has audio and it will print nothing if it doesn't. Currently the loop only prints pass on both the audio and non audio files. Is there a way to set the condition to stdout and determine if something was printed?

ffprobe -i INPUT -show_streams -select_streams a -loglevel error >/dev/null
if [ $? == 0 ]
then    
    echo pass
else
    echo fail
fi

Aucun commentaire:

Enregistrer un commentaire