hrc_sh: improvements to heredoc