SebS
SebS

Reputation: 591

How do I execute a command string in BASH?

I would like to execute the following from a bash script

exiftool -r -v5 -P -ext mov -ext avi -ext mp4 -ext 3gp "-Directory<MediaCreateDate" -d "/media/data/Home Movies/testdestdir/%Y/%b/" "/media/data/Home Movies/testsrcdir/"

I have built this by concatenating strings into a $CMDEXEC when echoing the variable it looks fine but I cannot execute it from bash script. I tried various combinations without luck.

`$CMDEXEC` >> $LOGFILE

$($CMDEXEC) >> $LOGFILE

etc.

Upvotes: 1

Views: 2283

Answers (1)

toddlermenot
toddlermenot

Reputation: 1618

Did you try eval "$CMDEXEC" >> "$LOGFILE" ?

Upvotes: 2

Related Questions