Automation on linux machine

[Closed]
Report
-
Posts
12
Registration date
Saturday March 28, 2009
Status
Member
Last seen
June 18, 2009
-
Hello,

I am working on automation.Could you please help me for this below q's?.

How to pass the commands from shell script to terminal(command prompt).
like,5 terminals should be opened and after that i have to pass four commands to four terminals.

for suppose:there are four commands in the script.From that script first command should be executed in the first terminal,second command should be executed in second terminal etc.

1 reply

Posts
12
Registration date
Saturday March 28, 2009
Status
Member
Last seen
June 18, 2009

Did you try creating a shell script?
You can try this:

#!/usr/local/bin/expect 
spawn telnet <machine ip> 
expect "login:" 
send "<username>\n" 
expect "Password:" 
send "<password>\n" 
send "bash\n" 
send "cd /opt\n" 
send "ls -ltr\n" &#61664; (if you are not giving \n then it will wait for your response or u have to type enter manually). 
interact 

How to execute the “expect“ command expect –f <file name> 
Ex: expect –f <filename>.expect