Pass commands as input to another command (su, ssh, sh, etc)
Adding to tripleee‘s answer: It is important to remember that the section of the script formatted as a here-document for another shell is executed in a different shell with its own environment (and maybe even on a different machine). If that block of your script contains parameter expansion, command substitution, and/or arithmetic expansion, then you … Read more