extract remote_bash, move out mktemp