The problem is that do_work.sh runs ssh commands and by default ssh reads from stdin which is your input ...
stackoverflow.com