Page 1 of 1

Quotes in bash script

PostPosted: Mon Dec 06, 2021 1:51 pm
by lnjustin
I am trying to run the following bash script. Converting an MTS file to an mp4 file, copying all time tags to the new mp4 file, and then adding the CreateDate tag with the correct date. Everything works except for the last command. I believe it has something to do with the quotations.

Code: Select all
date="$(<<< /usr/local/bin/exiftool -s -s -s -DateTimeOriginal $1)"
ifilename=$(basename $1)
ifilename="${ifilename%.*}"
/usr/local/bin/ffmpeg -i $1 -vcodec copy -acodec copy -map_metadata 0 "${ifilename}.mp4"
/usr/local/bin/exiftool -tagsFromFile $1 -overwrite_original -time:all "${ifilename}.mp4"
/usr/local/bin/exiftool "'-CreateDate=${date}'" "${ifilename}.mp4"


The problem in particular is when I attempt to set the CreateDate tag. The following works in the Mac Terminal, but it doesn't not work within Hazel:
/usr/local/bin/exiftool '-CreateDate=2021-12-06 12:00:00-5:00' filename.mp4

Help?

Re: Quotes in bash script

PostPosted: Mon Dec 06, 2021 7:31 pm
by lnjustin
Problem solved. Problem was with the first line. Should have been:
date=$(/usr/local/bin/exiftool -s -s -s -DateTimeOriginal $1)