Unable to pass send command in shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Unable to pass send command in shell script
# 1  
Old 04-13-2014
Unable to pass send command in shell script

I am trying to automate a testcase . I am installing some software and it waits for user input after displaying "Do you want to continue [Y/n]? " I am trying to do this in shell scripting.

Code:
#!/bin/bash
#!/usr/bin/expect -f
/usr/bin/expect << EOF
spawn apt-get install openjdk-7-jdk
expect "*Do you want to continue*"
send  "Y\r"
EOF
echo "hello"

In above code after spawn caommand executed it is waiting for expect. Once the expect is recieved i need to press enter but it skips that steps and printing echo.

Can anyone suggest me how to do this?
Thanks
Navaz

Moderator's Comments:
Mod Comment edit by bakunin: is it really that hard to use CODE-tags?

Last edited by bakunin; 04-14-2014 at 02:45 AM..
# 2  
Old 04-14-2014
Quote:
Originally Posted by Abdul Navaz
Code:
#!/bin/bash
#!/usr/bin/expect -f

You cannot use two commando processors in one script. Either use bash or use expect.

I hope this helps.

bakunin
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. HP-UX

Unable to send attachment with html tables in UNIX shell script

Heyy, any help would be grateful.... LOOKING FOR THE WAYS TO SEND AN EMAIL WITH ATTACHMENT & HTML TABLES IN BODY THROUGH SHELL SCRIPT (LINUX)..NOT SURE, IF WE HAVE ANY INBUILT HTML TAG OR UNIX COMMAND TO SEND THE ATTACHMENTS. KINDLY HELP below is small script posted for our understanding..... (2 Replies)
Discussion started by: Harsha Vardhan
2 Replies

2. Shell Programming and Scripting

Pass Arguments to Command from Shell Script

Hi all, I am working on a project, in which I have to connect to Bluetooth low energy device. I am able to connect and do data transfer from command line. But I want to do from script Here is my script #!/bin/bash #sudo hcitool -i hci0 lescan sleep 1 sudo hcitool -i hci0 lecc --random... (8 Replies)
Discussion started by: nithin@embdes
8 Replies

3. Shell Programming and Scripting

Unable to pass value from .Shell script to .SQL file

Hi All, I am new to shell script. I am trying to pass value from .sh file to .sql file . But I am able to run the .sql file from .sh file with values in sql file. But I am unable to pass the values from .sh file. can some one please help to resolve this. here is my .sh file s1.sh ... (4 Replies)
Discussion started by: reddy298599
4 Replies

4. Shell Programming and Scripting

Unable to pass shell script variable to awk command in same shell script

I have a shell script (.sh) and I want to pass a parameter value to the awk command but I am getting exception, please assist. diff=$1$2.diff id=$2 new=new_$diff echo "My id is $1" echo "I want to sync for user account $id" ##awk command I am using is as below cat $diff | awk... (2 Replies)
Discussion started by: Ashunayak
2 Replies

5. Post Here to Contact Site Administrators and Moderators

Unable to pass shell script parameter value to awk command in side the same script

Variable I have in my shell script diff=$1$2.diff id=$2 new=new_$diff echo "My id is $1" echo "I want to sync for user account $id" ##awk command I am using is as below cat $diff | awk -F'~' ''$2 == "$id"' {print $0}' > $new I could see value of $id is not passing to the awk... (0 Replies)
Discussion started by: Ashunayak
0 Replies

6. UNIX for Dummies Questions & Answers

How to pass command line argument in shell script?

I need to write a shell script, when I run that script I should pass those arguments if not, then script should not run and pass the error message like invalid option - - should pass the argument. and Exit from the script (8 Replies)
Discussion started by: Nsharma3006
8 Replies

7. Shell Programming and Scripting

How to pass command line argument in shell script?

I need to write a shell script, when I run that script I should pass those arguments if not, then script should not run and pass the error message like invalid option - - should pass the argument. and Exit from the script https://www.unix.com/images/misc/progress.gif (1 Reply)
Discussion started by: Nsharma3006
1 Replies

8. Shell Programming and Scripting

unable to pass value to user prompt from calling shell script

This is my script structure main script calls configure script which needs to be run as a different user and the configure script calls my application installation script. the application instruction script prompts the user for a directory which I need to pass from my main or configure script. ... (4 Replies)
Discussion started by: cmastays
4 Replies

9. Programming

How to pass the command line arguments to the shell script in c language?

hi, I am new in the shell script, and c programming with linux. I am looking to pass the arguments in c program that should be executed by the shell script. e.g. #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv) { int i; for (i=1;i<argc; i++) { ... (2 Replies)
Discussion started by: sharlin
2 Replies

10. Shell Programming and Scripting

Unable to use sort command in Shell Script

Hello All, I am creating a shell script that reads a file(test.txt) with the following data, 0.0.0.0 10.10.10.0 10.10.10.1 10.10.10.10 10.10.10.2 10.10.10.3 10.10.10.4 10.10.10.5 10.10.10.6 10.10.10.7 10.10.10.8 10.10.10.9 If I use the sort, the highest value I am getting is... (1 Reply)
Discussion started by: racbern
1 Replies
Login or Register to Ask a Question