LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-17-2017, 03:01 AM   #1
adept7771
LQ Newbie
 
Registered: Apr 2017
Posts: 2

Rep: Reputation: Disabled
Unhappy Expect package - quotes interrupt running of scripts


Hello community! I have installed Expect package for my debian server and it's work perfectly but i faced with one problem. Single quotes in Expect sripts all time interrupts running of script.

My example:

Code:
#!/bin/bash
#!/bin/expect
expect << END
spawn aptitude install MDS
expect "Accept this solution?" {send "n\r"}
expect "Accept this solution?" {send "Y\r"}
expect "Do you want to*" {send "Y\r"}
expect "To continue, enter*" {send "Yes\r"}
expect "To continue, enter*" {send "Yes\r"}
expect "Enter metadata_manager database name (leave blank for default \\'metadata_manager\\')\:" {send "metadata_manager\r"}
expect "Enter metadata_manager database username*" {send "\r"}
expect "Enter password:" {send "123\r"}
expect "Confirm password:" {send "123\r"}
expect "Installation can take some minutes*" {send "\r"}
expect "Enter the current IP address:" {send "10.130.139.114\r"}
expect "Do you want to use current ip*" {send "Y\r"}
expect "Enter the metadata enhancer address:" {send "127.0.0.1\r"}
expect "Enter account_manager database name*" {send "\r"}
expect "Enter account_manager database username*" {send "\r"}
expect "Enter password:" {send "123\r"}
expect "Confirm password:" {send "123\r"}
expect "Installation can take some minutes*" {send "\r"}
expect "Username*" {send "\r"}
expect "Email address:" {send "\r"}
expect "Password*" {send "1q2w3eGSV\r"}
expect "Password*" {send "1q2w3eGSV\r"}
expect "Enter metadata_storage database name*" {send "\r"}
expect "Enter metadata_storage database username*" {send "\r"}
expect "Enter password:" {send "123\r"}
expect "Confirm password:" {send "123\r"}
expect "Installation can take some minutes*" {send "\r"}
interact;
END
Each time when expect see question:

Enter metadata_manager database name (leave blank for default 'metadata_manager'):

Expect interrupt install-script... i tryed to write:

- \'
- \\'
- *

But it doesnt matter to my situation... i alredy have broke my mind with it and srtongly ask for help...
 
Old 04-18-2017, 12:50 AM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 355Reputation: 355Reputation: 355Reputation: 355
I have looked at several examples of expect scripts.

My suggestion is to remove
#!/bin/bash from your script.

Bash is probably interpreting the single quote as an unmatched quote.
 
Old 04-18-2017, 01:58 AM   #3
adept7771
LQ Newbie
 
Registered: Apr 2017
Posts: 2

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by bigrigdriver View Post
I have looked at several examples of expect scripts.

My suggestion is to remove
#!/bin/bash from your script.

Bash is probably interpreting the single quote as an unmatched quote.
I made in header:
Quote:
#!/usr/bin/expect
and refactored code of script:
Code:
spawn aptitude install MDS; 
expect "Accept this solution?" {send "n\r"};
expect "Accept this solution?" {send "Y\r"};
expect "Do you want to continue?" {send "Y\r"};
expect "To continue, enter \"Yes\"\; to abort, enter \"No\":" {send "Yes\r"};
expect "To continue, enter \"Yes\"\; to abort, enter \"No\"\:" {send "Yes\r"};
expect "Enter metadata_manager database name (leave blank for default 'metadata_manager'):" {send "test\r"};
But result is the same. Install script interrupting each time when it see question with quotes... also i tried

Code:
expect "Enter metadata_manager database name*" {send "test\r"};
But it didn't matter.
 
Old 04-18-2017, 03:32 PM   #4
jefro
Moderator
 
Registered: Mar 2008
Posts: 20,973

Rep: Reputation: 3403Reputation: 3403Reputation: 3403Reputation: 3403Reputation: 3403Reputation: 3403Reputation: 3403Reputation: 3403Reputation: 3403Reputation: 3403Reputation: 3403
Might try the script with autoexpect to see if it can fix it. ??
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Expect script: 2 questions: Send ssh response to txt, and send command with quotes Kgeil Linux - General 6 02-19-2015 12:52 PM
Need help with BASH-scripts and EXPECT ElFredrico Linux - General 17 05-17-2012 11:51 PM
Calling expect scripts from other expect scripts sevapopov Linux - Software 3 04-03-2008 09:33 PM
expect scripts and cron banderson Linux - Software 8 05-27-2005 04:44 AM
using expect scripts for remote admin jmr71769 Linux - General 3 01-21-2004 01:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:45 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration