bash script yes or no

Viewed 52

i am using script to login on servers..some servers prompt for "Are you sure you want to continue (yes/no)" and some not..i am using script like.. if it prompt for yes/no then it send yes and if it dont prompt then continue and execute other line in script, my script is not getting succcessful, could you pls see what is issue here.

#!/usr/bin/bash

read -r -p "Are you sure you want to continue connecting (yes/no)? " response
if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]]
then
    send "yes\r"
fi
0 Answers
Related