Is this a bug, or just my misunderstanding about the scope of the "HERE" operator (<<)? Consider the following program:
echo THIS WORKS cat <<GOOD | tr -d V= | grep '[0-9]*' V=1234 abcd GOOD echo THIS DOES NOT WORK foo=$(cat exp_test <<BAD | tr -d V= | grep '[0-9]*') V=1234 abcd BAD When executed, it yields the following output: THIS WORKS 1234 abcd THIS DOES NOT WORK exp_test: line 9: abcd: command not found exp_test: line 10: BAD: command not found Obviously, the lines which are supposed to belong to the second HERE document, are not fed into the pipe, when the pipe is part of a $(...) output substitution operation. Is this the way bash is supposed to behave? Is there an elegant workaround? I would like to store the value of such a pipe (of course the example given shows only the principle) into a variable. Of course I could do: cat exp_test <<UGLY | tr -d V= | grep '[0-9]*' >temp_file V=1234 abcd UGLY foo=$(temp_file) rm temp_file but maybe there is a better solution. Ronald _______________________________________________ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash