This question already has an answer here:
- spawn - command not found! 3 answers
I want to pass server name which is listed in a file (servers_list) as variable to spawn command which is in another script (user_create_script). Purpose of this script is to create user(david) in multiple servers.
#cat servers_list server1 server2 server3 #cat user_create_script spawn ssh -t user@$i sudo /usr/sbin/useradd david expect "password:" send "pass123\r" interact