echo foo >t1 cat t1 - <<-EOF | bla$$bar EOF tr '[a-f]' '[A-F]' echo try2 res=$(cat t1 - <<-EOF | bla$$bar EOF tr '[a-f]' '[A-F]') echo "<$res>" rm t1