1 parent b4552a9 commit a4c4cd8Copy full SHA for a4c4cd8
1 file changed
AutomateLoginSSH.sh
@@ -0,0 +1,20 @@
1
+#!/usr/bin/expect -f
2
+## Testing expect command
3
+
4
+## echo the test
5
+puts "\nGet HostName\n"
6
7
+## execute ssh command to connect to remote host
8
+spawn ssh 192.168.175.130 "hostname"
9
10
+## Look for password string
11
+expect "password:"
12
13
+## Send the password
14
+send "redhat\r"
15
16
+puts "\nGet df command output\n"
17
+spawn ssh 192.168.175.130 "df -h"
18
19
20
+interact
0 commit comments