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
#!/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
#!/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.