Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I found this script on the arch wiki which prefixes an ffmpeg command like this

< /dev/null ffmpeg -i "$a" -qscale:a 0 "${a[@]/%flac/mp3}"

I understand the ffmpeg command, it is the < /dev/null part. Is it supposed to redirect the verbose output to /dev/null/?

share|improve this question

1 Answer 1

up vote 10 down vote accepted

No... it is reading from /dev/null. command < input and < input command are equivalent.

(So are > output command and command > output, by the way.)

share|improve this answer
    
Well now I am more confused. Why would it read from /dev/null, when it /dev/null only yields EOF. Why not just use EOF? –  cheezsteak Mar 11 at 17:03
    
Redirecting stdin from /dev/null is the easiest way to get an immediate EOF. How else would you do it? –  Blacklight Shining Mar 11 at 17:23
3  
@PhilipWales, what's EOF? Redirecting input from /dev/null makes sure every read returns nothing. Alternative, shorter but less efficient is :|ffmpeg ... –  Stéphane Chazelas Mar 11 at 17:24
3  
@PhilipWales Redirecting input to /dev/null seems overkill, but it is a common technique to prevent the program from accidentally reading something from the keyboard buffer. E.g. say you have a program that will abort a lengthy operation if it receives an Escape from the keyboard. In most terminals Function-keys generate Escape-seqeuences... Reading from /dev/null will then prevent an unintended abort by a clumsy user pressing the wrong key by accident. –  Tonny Mar 11 at 23:33
    
@Tonny: How is it overkill? –  Keith Thompson Mar 12 at 0:38

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.