I have an Expect Script that ssh'es to a server and does some stuff.
In Expect there is a built-in Array Variable called "expect_out(buffer)" which contains all the output from the previous send command up until the expected output.
I want to pass the array "expect_out(buffer)" to a Procedure/Function I have.
After I pass the array I have a loop that I use to loop through each element line by line.
I am able to successfully do this loop outside of the Procedure using that expect_out(buffer) array...
So how can I convert this code below, to use a new array variable argument in the procedure?
So how can I basically do the same thing as above, but this time I have to change the split function to use this new Array Variable "outputArray" that had "expect_out(buffer)" passed into it?
I've tried a couple of different ways to do the split command but nothing seems to work...
Dear Tech Guys,
I am trying to send some commands on the local server and it always asks for user name and password after each command. To serve the purpose I am using expect function as follows:
#!/usr/bin/expect
set timeout 20
spawn "./data1.sh"
expect "Please Enter UserName: "... (6 Replies)
I'm fairly new to scripting so this might not be possible.
I am using Expect with Cisco switches and need to capture the string after finding the expect request. For example, when I issue "show version" on a Nexus switch, I'm looking to capture the current firmware version:
#show version
... (0 Replies)
hii,,
I am trying to automate jira. during my scripting using bash script, in the terminal i got the terminal message like this:
"Configure which ports JIRA will use.
JIRA requires two TCP ports that are not being used by any other
applications on this machine. The HTTP port is where you... (1 Reply)
hi,
i have a problem with my expect script, here is MyScript:
#!/usr/bin/expect
set pass
set c
set command
spawn sudo $command
expect "assword"
send "$pass\r"
expect eof My problem is that when i execute MyScript with the command : "./MyScript mypassword apt-get_install_git"i get... (6 Replies)
Hi all,
I want to connect to some host with "ssh". I have googled and got some commands of "expect" and "spawn". I was not aware of these commands and tried below script.
$ cat auto.sh
set host xx.xx.xx.xx
set password abcd@1234
set user root
spawn ssh $user@$host
expect "*?assword:*"... (4 Replies)
I have a really basic expect script which I call from php. I works fine when I run the php from the shell, but from the web it appears as if the output buffer gets chopped and never gets all of the contents.
php script: (runexpect.php)
<?php... (7 Replies)
Can 'spawn' script be used more than once in a given expect script ??
What I'm trying to do is, first log-into a remote server through one 'ssh' spawn com and then from there log-into another server using a secod 'ssh' spawn command. But this approach is not working... the second ssh attempt... (1 Reply)
Hi all,
I'm trying to run the sipp simulator in crontab but after some attempt I came to the conclusion that for some reason this isn't possible (maybe due to sipp interactive nature).
This is confirmed by these posts.
Now I'm trying to launch sipp from an expect script that runs in crontab.
... (0 Replies)
This Expect script provides expect with a list of IP addresses to Cisco IPS sensors and commands to configure Cisco IPS sensors. The user, password, IP addresses, prompt regex, etc. have been anonymized. In general this script will log into the sensors and send commands successfully but there are... (1 Reply)
Hello to all...this is my first post (so please go easy). :)
I feel pretty solid at expect scripting, but I'm running into an issue that I'm not able to wrap my head around. I wrote a script that is a little advanced for logging into a remote Linux machine and changing text in a file using sed.... (2 Replies)