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:
here i want to change the port if i have entered a string for that port or just continue with the default.if i am trying with the custom values, i will get the message like that, i want to type enter the custome values there.
all these process iam doing with expect and i getting done when i go without changing the port values.my succeess code is as below:
but now when i tried to change that ports , my code is:
and iam getting the error as:
Please give mea solution ASAP.
thanks...
Last edited by Scott; 07-27-2012 at 07:54 AM..
Reason: Please use code tags
That's just not how if statements work in expect, if I'm reading it right. Most of your checks come down around like the below:
I don't have expect handy this second, but I think this would be right
You just need to adjust how you're doing if statements - bourne syntax isn't right for an expect/tcl 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.
... (1 Reply)
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)
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)
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)
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)
Hi All,
Is there any way to monitor a command inside shell script ? I have a script inside which I have a tar command which zips around 200GB data.
tar zcvf $Bckp_Dir/$Box-BaseBackup-$Day.tar.gz * --exclude 'dbserver_logs/*' --exclude postmaster.pid --exclude 'pg_xlog/*'
I want to... (3 Replies)
Hi all,
I am using the below given sqlplus command in my unix script to invoke a stored procedure which returns a value .It works fine.
RET_CODE=$(/opt/oracle/product/10.2.0.4.CL/bin/sqlplus -S $USER/$PASSWD@$DB_NAME <<EOF
EXEC MY_PKG.MY_SP (:COUNT);
PRINT COUNT;
commit;
... (6 Replies)
hi,
i wat to get the output of a grep command in a file. but when i am trying out the same grep command in the unix prompt its working fine.. i am getting the output properly.. but when i am writing the same command inside my shell script , its just creating a new output file with no contents... (11 Replies)
hi,
i wat to get the output of a grep command in a file. but when i am trying out the same grep command in the unix prompt its working fine.. i am getting the output properly.. but when i am writing the same command inside my shell script , its just creating a new output file with no contents... (1 Reply)