 <p>Ignoring the fact that <code>eval</code> is probably super dangerous to use here (unless the data in <code>somefile</code> is controlled by you and only you), there are a few issues to fix in your example code.</p> <p>In your <code>for</code> loop, <code>alert_list</code> needs to be <code>$alert_list</code>.</p> <p>Also, as pointed out by @choroba, you should be using <code>!=</code> instead of <code>-ne</code> since your input isn't always an integer.</p> <p>Finally, while debugging, you can add <code>set -x</code> to the top of your script, or add <code>-x</code> to the end of your shebang line to enable verbose output (helps to determine how bash is expanding your variables).</p> <p>This works for me:</p> <pre><code>#!/bin/bash -x data=2.2 version=1 al_ap_version=('ap_version' '[[ $data != $version ]]') alert_list='al_ap_version' for alert in $alert_list; do condition=$(eval echo \${$alert[1]}) if eval "$condition"; then echo "alert" fi done </code></pre>