I have a part of a script that isn't working as expected. It's supposed to take a list of newline-delimited episode paths in the format "/volume1/Shared Files/Cartoon/Show Name/Show Name SXX/file.mkv" (quotes included in the list file), run those files through mediainfo and append the UID to each line.
I can obtain the UID with the one-liner
/volume1/@appstore/nzbdrone/bin/mediainfo "/volume1/Shared Files/Cartoon/Show Name/Show Name SXX/file.mkv" | grep Unique | awk '{print $4}'
However, when executing the following code:
while read line; do
echo $line
/volume1/@appstore/nzbdrone/bin/mediainfo $line | grep Unique | awk '{print $4}' > $WorkingDir/output2.txt
echo `/volume1/@appstore/nzbdrone/bin/mediainfo $line | grep Unique | awk '{print $4}'`
var1=`echo /volume1/@appstore/nzbdrone/bin/mediainfo $line | grep Unique | awk '{print $4}'`
echo $var1
done < $WorkingDir/output.txt
I get the following output:
"/volume1/Shared Files/Cartoon/Show Name/Show Name SXX/file.mkv"
"/volume1/Shared Files/Cartoon/Show Name/Show Name SXX/file.mkv"
"/volume1/Shared Files/Cartoon/Show Name/Show Name SXX/file.mkv"
"/volume1/Shared Files/Cartoon/Show Name/Show Name SXX/file.mkv"
"/volume1/Shared Files/Cartoon/Show Name/Show Name SXX/file.mkv"
"/volume1/Shared Files/Cartoon/Show Name/Show Name SXX/file.mkv"
I know this wouldn't append the UIDs where I want, this is just an attempt at debugging. I'd expect at least one of those two blank lines between each echo $line would contain the UID. I don't know where it's going wrong :/
(running under bash on a Synology DS412+)