I'm tring to obtain the format info of a bunch of media files in a directory. The script I have goes through each file, mentions what format its in (if it's a media file) and then exits. What I really wanted to do was to run a specific command if the output matched a certain value. here's the code I have:for file in ./*do    ffprobe -v error -select_streams a:0 -show_entries stream=codec_name -of default=nokey=1:noprint_wrappers=1 $file doneHere's a sample output I get when I run it in a folder with 10 files and 1 directory:vorbisaacopusvorbismp3opusmp3./file1.txt: Invalid data found when processing input./Soundcloud: Is a directorymp3./media_bash_file.sh: Invalid data found when processing inputIdeally, what I'm trying to do is once the ffprobe command runs I want to goif ffprobe_output = vorbis then run x command ELSE ...and so on. I've tried what's mentioned in various blog posts about usingvar=$(insert_ffprobe_command_here) at the very start of the batch file but I can't seem to get it to work properly, it usually results in an error like:Argument './Mediafile_X' provided as input filename, but './Mediafile_Y' was already specified.I only have gotten as far as the first snippet of code I made. 
How do I use the output of a command for a process within a loop in Bash?
shell script