4
I’m comparing two images using Imagemagick on the LINUX terminal.
When I type in the Terminal line this (below) it returns a value to me:
$ compare -metric mae 0.jpg 2.jpg null:
But I can’t put this value in a variable to later make a comparison within a BASH Script. Below how I write and give me error (or better: The variable is still empty and the value is still on the screen):
var=`compare -metric mae 0.jpg 2.jpg null:`
even so:
var=$(compare -metric mae 0.jpg 2.jpg null:)
When I type: echo $var
nothing comes out! Someone help me?
As a step to a variable the value of a COMPARE -METRIC
?
Try
var=$(compare -metric mae 0.jpg 2.jpg null: 2>&1)
– Valdeir Psr
Thanks Valdeci!!! That’s right! It was missing the 2>&1 .... Now it works perfectly!!!!
– Helio Giroto