Read variable from client after connecting to remote server via ssh in bash

Well, I connect to a remote server via ssh in bash like something below:

    ssh root@$REMOTE_IP REMOTE_WORK_DIR=$REMOTE_WORK_DIR  REMOTE_WAR_DIR=$REMOTE_WAR_DIR LOCAL_IP=$LOCAL_IP PARAMETERS="$@" 'bash -s' <<'ENDSSH'
        shell script codes...
    ENDSSH

And I need some confirmation from client, so I added some codes in shell script codes like

read -r -p "Are you sure? [y/N] " response

But I found it not effective, bash just ignored the read sentence, I know something must be wrong with those codes and can anyone figure it out for me, thanks a lot.


Source: shell

Leave a Reply