I am executing the below 
#!/bin/bash
###############################################################################
# This script can copy any file from Present machine to machine with IP as Test_ip and execute it :)  #
###############################################################################
############################ Main code starts here ####################################
Test_ip="10.20.12.206"
home=`pwd`
expect -c "
   spawn ssh root@$Test_ip \"mkdir /test_machine\"
   expect yes/no { send yes\r; exp_continue }
   expect password { send gaur\r; exp_continue }
   exit
        "
 expect -c "
   spawn scp $home/run_check_node.sh $home/script_3.sh $home/script_2.sh  root@$Test_ip:/test_machine/
   expect yes/no { send yes\r; exp_continue }
   expect password { send gaur\r; exp_continue }
   exit
        "       
expect -c "
    spawn ssh root@$Test_ip \"chmod +x /test_machine/run_check_node.sh /test_machine/script_2.sh /test_machine/script_3.sh;\"
    expect yes/no { send yes\r; exp_continue }
    expect password { send gaur\r; exp_continue }
    exit
        "
expect -c "
    spawn ssh root@$Test_ip \". /test_machine/script_2.sh\"
    expect yes/no { send yes\r; exp_continue }
    expect password { send gaur\r; exp_continue }
    exit
        "
The script shown is script_1.sh.
In the above code, I am creating a directory on Test_ip and then copying all 3 files ( script_2.sh, script_3.sh and run_check_node.sh) from current machine to other machine (Test_ip) using scp. Then I gave execute permission to them. When I am trying to do spawn ssh root@$Test_ip \". /test_machine/script_2.sh\", it is accepting password and then displaying "/test_machine/script_2.sh: No such file or directory".
I am not getting why it is telling like that. It just made all of them executable and at next command, claiming that the file does not exist!
 
    