Is it possible to output the result of a command to a file AND set a variable, all in the same command?
The following will append the output to a file, but wont set var.
for i in myarray; do
var=$(command >> file)
done
Not sure if this is possible or not.