I'm currently trying to make a dynamic test with [[]] and evaluated code, but there is a -n that is added automaticaly at the beginning of the conditions. So my conditions are always true...
Here an example with set -x :
myCondition='${queueName} == ${pattern}'
pattern="COMPLETELY_DIFFERENT_PATTERN"
queueName="QM.GCS.SRC.TOTO"
set -x ; [[ $(eval echo $myCondition ) ]] && echo CORRECT; set +x
++ eval echo '${queueName} == ${pattern}'
+++ echo QM.GCS.SRC.TOTO == COMPLETELY_DIFFERENT_PATTERN
+ [[ -n QM.GCS.SRC.TOTO == COMPLETELY_DIFFERENT_PATTERN ]]
+ echo CORRECT
CORRECT
+ set +x
Why the -n is added ? Because there is only one parameter ?
How i can make it work as i want ?
Aucun commentaire:
Enregistrer un commentaire