Sponsored Content
Full Discussion: expect minicom
Top Forums Shell Programming and Scripting expect minicom Post 302511966 by vanid on Friday 8th of April 2011 06:20:24 AM
Old 04-08-2011
expect minicom

Hi,

I am new to using minicom. I want how to write a expect script for minicom login? I wrote a code but its not acting what iam expecting. here I have my code:

Code:
#!/usr/bin/expect

set fd [ open /dev/ttyUSB1 { RDWR NONBLOCK } ]

fconfigure $fd

spawn -open $fd

  spawn minicom
expect “enter:”
send "\n"
send "\n"


expect \
"Valiant login: " {
exp_send "username\n"
exp_continue
} "Password: " {
exp_send "password\n"
exp_continue
}

Response for above code:

Code:
spawn [open ...]
spawn minicom

Welcome to minicom 2.4

OPTIONS: I18n 
Compiled on Jun  3 2010, 13:46:31.
Port /dev/ttyS0

Press CTRL-A Z for help on special keys

Error CLI cmd Not Found !


ETH-T1>
ETH-T1>root@vani:~#

but here I want output like:
it should show my login and password message which is sent from my hardware but it is jumping without showing it directly to my command line and existing from that session (login) . I dont want to exit from the login session

Is their any problem in my code: please do suggest me thank you

---------- Post updated at 05:20 AM ---------- Previous update was at 03:10 AM ----------

Actual what iam expecting is:
i am trying to write a script to logon to a system using minicom.
when I do minicom in my shell...
i want screen as below:
=================================
Welcome to minicom 2.4

OPTIONS: I18n
Compiled on Jun 3 2010, 13:46:31.
Port /dev/ttyS0

Press CTRL-A Z for help on special keys
==================
=========== ===========

Welcome to System Manager

System Configuration:
PROCESSOR : ARM926ej-s @ 398 MHz
RAM : 64 MBytes, DDR-1
FLASH : 512 MBytes, HYNIX SLC
OPERATING SYSTEM: GNULinux 2.6.31

Valiant login: username
Password: password

==============================
but...........

* my problem is iam not able to see the screen as above for login instead it gives as below

==============================
Welcome to minicom 2.4

OPTIONS: I18n
Compiled on Jun 3 2010, 13:46:31.
Port /dev/ttyS0

Press CTRL-A Z for help on special keys

username
Unknown OAM Command:"username"

ETH-T1>password
Cant accept reserved characters in your command

ETH-T1>
ETH-T1>$$config/oam
Unknown OAM Command:"$$config/oam"



==============================
My commands are:


#!/usr/local/bin/expect —f
log_file -noappend logfile_telnet
set timeout 2
set user "username"
set password "password"
spawn minicom
expect "enter:"
send ""

expect "login:\r"
send "$user\r "
expect "Password:\r"
send "$password\r"
expect "$ " #passing command after login
send "\$\$config/oam\r"


when i do a spawn telnet instead of this the script runs fine........

thank you

Last edited by vanid; 04-08-2011 at 02:34 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

linux - minicom

hello. i'm attempting to use minicom in linux, but i'm having some difficulties. When i type in "minicom", the application opens up. It says 'starting minicom/finding modem'(something like that). However, once it actually starts, I can't do anything. No matter what I type in, it doesn't work. ... (2 Replies)
Discussion started by: kickboxer
2 Replies

2. UNIX for Dummies Questions & Answers

Minicom Scripting

Does anyone have a working minicom script they would care to post as I can't get the scripting working and the scriptdemo and unixlogin sample scripts are on my system either. Thanx, I (2 Replies)
Discussion started by: ianf
2 Replies

3. Red Hat

Minicom with VMWare ESX Server

Hello! I have an ESX Server up and running. Now I want to connect a serial device to the COM Port. For that I need the minicom program. When I try "configure - make - make all" I get some errors. Can someone please explain to me, what the problems are: # ./configure checking for a... (3 Replies)
Discussion started by: Kickbit
3 Replies

4. Shell Programming and Scripting

running scripts in minicom

Hi, I am new to use minicom. I want script to run on minicom with username and password as automated.(Expect). please could anyone suggest the sample code for it. Thanks in advance (2 Replies)
Discussion started by: vanid
2 Replies

5. Shell Programming and Scripting

minicom works, but stty does not

Hi all, I have some trouble getting stty to talk to some serial/usb converter. Getting minicom to work was however quite simple after I entered the following settings in addition to its standard-setup: pu port /dev/ttyUSB0 pu baudrate 19200 pu bits 8 pu... (3 Replies)
Discussion started by: pa-trick
3 Replies

6. Shell Programming and Scripting

Exiting from Minicom on a shell script

This is what I've tried: #!/bin/sh send sh send showifs send exit ! killall minicom My problem is that for some reason when I do this it doesn't give me the results of the prior commands sent like showifs So I suspect my syntax is wrong. (1 Reply)
Discussion started by: uradunce
1 Replies

7. Shell Programming and Scripting

Little script with minicom

Hi all, i must do a little script that send AT command at ttyUSB3.. for example: Start Minicom: Set serial port ttyUSB3 AT+CREG? if response != OK then do something ...other AT command (open a socket tcp/ip with at comman) Send a file .txt for example. exit minicom. I saw on the... (49 Replies)
Discussion started by: enaud
49 Replies

8. Shell Programming and Scripting

Help with minicom script

I'm a fairly new user to Linux based systems and am still a little uncomfortable with using the command interface. I'm trying to get my feet wet but have unfortunately hit a wall and am actually not even sure what I am trying to accomplish is at all possible. Basically, I am trying to use a... (0 Replies)
Discussion started by: nrdk00
0 Replies

9. Shell Programming and Scripting

Expect script not working in crontab with minicom

Hi All, I am testing expect script in command prompt without issue, but in crontab it is not working, i check the output error as below: #cat /var/log/testexp.log spawn minicom -C /var/log/minicom1.log No cursor motion capability (cm) AT+COPS=? I am new in scripting, together... (1 Reply)
Discussion started by: elingtey
1 Replies

10. SCO

Minicom

hello is there a copy of minicom or equivalent for unixware 7? thanks (3 Replies)
Discussion started by: deus-programmer
3 Replies
All times are GMT -4. The time now is 08:12 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy