Sponsored Content
Top Forums Shell Programming and Scripting How to merge Expect script inside shell script? Post 302939502 by ashish_neekhra on Thursday 26th of March 2015 03:11:46 AM
Old 03-26-2015
How to merge Expect script inside shell script?

Hi I have two scripts one is Expect and other is shell.

I want to merge Expect code in to Shell script so that i can run it using only one script. Can somebody help me out ?

Order to execute: Run Expect_install.sh first and then when installation completes run runTests.sh shell script.



Expect_install.sh

Code:
#!/usr/bin/expect
set ViPR_HOSTNAME [lindex $argv 0]
set timeout 300

cd /root/cli-build
system "rm -rf /opt/storageos/cli/*"

sleep 5
system "wget https://$ViPR_HOSTNAME:4443/cli --no-check-certificate --content-disposition"
sleep 5
system "tar -xvf ViPR-cli.tar.gz"
sleep 5
spawn "python" "setup.py" "install"
sleep 5
expect "Installation Directory " { send " \r" }
sleep 5
expect "ViPR host " { send "$ViPR_HOSTNAME\r" }
sleep 5
expect "ViPR port " { send " \r" }
sleep 300
system "rm -rf /root/cli-build/ViPR-cli.tar.gz"
interact


runTests.sh


Code:
#!/bin/sh

echo $1
export PATH=$PATH:/opt/apache-maven-2.2.1/bin
export M2_HOME=/opt/apache-maven-2.2.1
sed -i s/VIPR_HOSTNAME=\.\*/VIPR_HOSTNAME=$1/g /opt/storageos/cli/viprcli.profile
source /opt/storageos/cli/viprcli.profile
/opt/apache-maven-2.2.1/bin/mvn clean
/opt/apache-maven-2.2.1/bin/mvn test
exit 0

Here while executing both the script takes same argument i.e. IP address.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to run shell script inside expect script?

I have the code like this : shell script continues ... .... expect -c" spawn telnet $ip expect "login:" send \"$usrname\r\" expect "Password:" send \"$passwd\r\" expect "*\>" send \"$cmdstr\r\" ... (1 Reply)
Discussion started by: robbiezr
1 Replies

2. Shell Programming and Scripting

how to read line inside expect script

hi, i have an existing ftp script that needs to be translated to SFTP so i have to use expect script to automate the login to the remote server. Now im facing with a problem becaise i have at least 50 files to be renamed ont he remote server. It's a hassle to hardcode every single command... (1 Reply)
Discussion started by: The One
1 Replies

3. Programming

Expect script to run a Shell script on remote server

Hi All, I am using a expect script to run a shell script on remote server, the code is as follows. But the problem is that it executes only first command, and hangs it doesn't run the next commands. spawn ssh $uid@$host expect "password:" send "$password\r" expect "*\r" send... (2 Replies)
Discussion started by: yashwanthsn
2 Replies

4. Shell Programming and Scripting

Can i use if else inside expect command in shell script?

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)
Discussion started by: nithinfluent
1 Replies

5. Shell Programming and Scripting

Passing username and password to a script running inside "expect" script

Hi I'm trying to run a script " abc.sh" which triggers "use.sh" . abc.sh is nothing but a "expect" script which provides username and password automatically to the use.sh script. Please find below the scripts: #abc.sh #!/usr/bin/expect -f exec /root/use.sh expect "*name*" send... (1 Reply)
Discussion started by: baddykam
1 Replies

6. Programming

Calling expect script inside another expect

Hi, Am very new to expect scripting.. Can You please suggest me how to call an expect script inside another expect script.. I tried with spawn /usr/bin/ksh send "expect main.exp\r" expect $root_prompt and spawn /usr/bin/ksh send "main.exp\r" expect $root_prompt Both... (1 Reply)
Discussion started by: Priya Amaresh
1 Replies

7. Shell Programming and Scripting

expect script inside shell script not working.

Shell Scipt: temp.sh su - <$username> expect pass.exp Expect script: pass.exp #!/usr/bin/expect -f # Login ####################### expect "Password: " send "<$password>\r" it comes up with Password: but doesnt take password passed throguh file. (2 Replies)
Discussion started by: bhavesh.sapra
2 Replies

8. Programming

Calling another expect script inside an expect script

I have an expect script called remote that I want to call from inside my expect script called sudoers.push, here is the code that is causing me issues: set REMOTE "/root/scripts/remote" ... log_user 1 send_user "Executing remote script as $user...\n" send_user "Command to execute is: $REMOTE... (1 Reply)
Discussion started by: brettski
1 Replies

9. Shell Programming and Scripting

Expect not working inside my Bash script

I am trying to execute expect command inside by small bash script to login into servers using key authentication method. My script is as follows: #!/bin/bash HOST=$1 /usr/bin/expect -c " spawn ssh -i /root/.ssh/id_rsa root@$HOST expect -exact "Enter... (3 Replies)
Discussion started by: John Wilson
3 Replies

10. Shell Programming and Scripting

Capture run time of python script executed inside shell script

I have bash shell script which is internally calling python script.I would like to know how long python is taking to execute.I am not allowed to do changes in python script.Please note i need to know execution time of python script which is getting executed inside shell .I need to store execution... (2 Replies)
Discussion started by: Adfire
2 Replies
gnutls-cli-debug(1)					      General Commands Manual					       gnutls-cli-debug(1)

NAME
gnutls-cli-debug - GnuTLS test client, with verbose output SYNOPSIS
gnutls-cli-debug [options] hostname DESCRIPTION
Simple client program to set up a TLS connection to some other computer. Like gnutls-cli(1), it sets up a TLS connection and forwards data from the standard input to the socket. Any information about the TLS control connection is printed to standard error. OPTIONS
-d, --debug integer Enable debugging. -p, --port integer The port to connect to. -h, --help Prints a short reminder of the command line options. -v, --verbose Even more verbose output. SEE ALSO
gnutls-cli(1), gnutls-serv(1) AUTHOR
Nikos Mavroyanopoulos <nmav@gnutls.org> and others; see /usr/share/doc/gnutls-bin/AUTHORS for a complete list. This manual page was written by Ivo Timmermans <ivo@debian.org>, for the Debian GNU/Linux system (but may be used by others). December 1st 2003 gnutls-cli-debug(1)
All times are GMT -4. The time now is 09:38 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy