Bash - how do i output line and then pipe line to another command side by side?
<p>Perhaps best explained with an example. I want to do this:</p>

<p>file: </p>

<pre><code>one
two
three
</code></pre>

<p>command:</p>

<pre><code>cat file | xargs -n1 show_square_of_stringed_number
</code></pre>

<p>output:</p>

<pre><code>one one
two four 
three nine
</code></pre>

<p><code>show_square_of_stringed_number two</code> just returns <code>four</code>, and can only accept one argument. </p>

<p>Not looking for the implementation of <code>show_square_of_stringed_number</code>, but simply how to echo the input to the pipe (two) alongside the output (four). </p>

<p>Wishing <code>xargs</code> had this feature built in. Can't do it with <code>tee &lt;(show_square)</code> either because it operates on the entire list, not on a single row. </p>