Drop bash and use tcl. Why didn't I do this earlier? Tcl devours most tasks and is so easy. Love it. You will too.