LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-12-2007, 04:47 AM   #1
Queenie245
LQ Newbie
 
Registered: Oct 2007
Posts: 1

Rep: Reputation: 0
Expect Utility newbie


Hi Everyone,

This is my first post to this forum. Iam not quite sure iam in the right location to post my query in this forum.

Can anyone guide me what exactly is the Expect Utility. Iam a very new user to linux.

Can we use this expect utility to write and run scripts? Is it like a telnet client with WAIT, SEND and SLEEP commands?

What does the expect Utility exactly do? Does if have conditional statements. How to install and start this utility?

BACKGROUND:
Iam using BDI2000 JTAG tool for debugging my target boards. The CLI prompt for the BDI tool is accessed via telnet.

At this prompt, if the JTAG connection is succesfully then via telnet, the config files for reqd target board are loaded. BDI provides a telnet server which has to be enabled prior to this.

Now once the config files are taken, we get the processor prompt on the BDI CLI.

Its here that I want to write scripts for checking various hardware sections of my target board. For this...I was wondering if i could use the Expect utility.

For example if i want to test the datalines of my SDRAM(memory)
Want i would like to do is... write some data(hex) into a certain memory location and read it back. if its the same as the data written, then i could assume the datalines of the memory is fine. but if the data recieved is not the same, then i need need to convert this data into a binary and find out which is the dataline causing the problem.

Can anyone help me... how i could do this using the expect script. how do we run a expect script?

Warm Regards

Queenie
 
Old 10-12-2007, 09:59 AM   #2
makyo
Member
 
Registered: Aug 2006
Location: Saint Paul, MN, USA
Distribution: {Free,Open}BSD, CentOS, Debian, Fedora, Solaris, SuSE
Posts: 735

Rep: Reputation: 76
Hi.

Essentially, the answer to your question is "yes", for more details, there is a long man page for expect:
Quote:
INTRODUCTION
Expect is a program that "talks" to other interactive programs accord-
ing to a script. Following the script, Expect knows what can be
expected from a program and what the correct response should be. An
interpreted language provides branching and high-level control struc-
tures to direct the dialogue. In addition, the user can take control
and interact directly when desired, afterward returning control to the
script.

-- excerpt from man expect
A brief intro with examples at http://en.wikipedia.org/wiki/Expect

The book below is very useful.

There are almost 2 M hits from Google expect linux unix libes

Best wishes ... cheers, makyo
Code:
Title: Exploring Expect
Subtitle: A Tcl-based Toolkit for Automating Interactive Programs
Author: Don Libes
Edition: First
Date: December 1994
Publisher: O'Reilly
ISBN: 1-56592-090-2
Pages: 602
Categories: scripting, interacting, automating, system administration
Comments: 3.5 stars (25 reviews) http://www.amazon.com
Comments: elderly book, but still useful
( edits : add Google, Wikipedia )

Last edited by makyo; 10-12-2007 at 10:07 AM.
 
Old 10-12-2007, 10:07 AM   #3
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
Expect is amazingly useful. I love it.
 
  


Reply



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
Newbie - What is this utility called? mlota Linux - Newbie 6 10-08-2003 05:23 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:29 PM.

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