I'm trying to get the audio type in an OSX sh
script using ffprobe: ffprobe "$i" |& egrep -ci "vorbis|aac"
it works from cli in tcsh
but not from script. |&
doesn't seem to work from inside script. |&
redirects the output from ffprobe, otherwise ffprobe prints out to cli. Any help is appreciated.
##mkv files
for i in "$input"*.mkv ; do
if [ -e "$i" ] ; then
##1st check type(vorbis|aac)
type=$(/usr/local/bin/ffprobe "$i" |& egrep -i "vorbis|aac")
echo "Test: $type"
##just get audio format
type=$(/usr/bin/perl -e '$_=@ARGV[0];if (/(aac|vorbis)/ig) {print $1;}' "$type")
echo "Type: $type"
exit
fi
done
error I get is:
command substitution: line 46: syntax error near unexpected token `&'
command substitution: line 46: `/usr/local/bin/ffprobe "$i" |& egrep -i "vorbis|aac"'