 <p>Check this:</p> <pre><code>seq 12 | xargs -i echo "256 * 2 ^ ({} - 1)" | bc | xargs -i echo ./a.out {}.txt </code></pre> <p>If it's OK, then drop <code>echo</code> and add <code>&gt;&gt; output.txt</code></p> <pre><code>seq 12 | xargs -i echo "256 * 2 ^ ({} - 1)" | bc | xargs -i ./a.out {}.txt &gt;&gt; output.txt </code></pre>