[I've just created a bug report at Savannah, but looking at the Bash page on gnu.org I realised it should have ben sent here rather than <http://savannah.gnu.org/support/?107823>]
Run these command: $ gcc -x c - <<EOT #include <stdio.h> int main() { printf("hi\n"); } EOT $ ./a.out hi now use the up cursor (or "fc -2" or any equivalent) to return to the gcc command, it has been mangled to: gcc -x c - <<EOTint main() { printf("hi\n"); } EOT This is not the same command. A # in a here-document is not a shell comment!