Printing output during a non-interactive shell breaks SCP. Edited scripts so actions that are not appropriate during a non-interactive shell are only executed during an interactive shell.