[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Microcom; What's this Script Feature?



I will reply to both excellent responses.  Thank you.
Dan Ritter <dsr@randomstring.org> writes:
> Time to learn the awesome power of Linux.
> 
> Three ways to do this:
> 
> 1. shell script
> 
> Create a text file with the following two lines of code:
> 
> #!/bin/sh
> exec microcom -f -p/dev/ttyUSB4 -s9600
> 
> Name it something short and memorable, like serial
> 
> Then
> 
> chmod a+rx serial
> 
> And from then on, it's a program you can run.
> 
> 2. shell alias
> 
> Most shells have aliases available. In bash, you can stick them
> in your .bashrc file. Add this line:
> 
> alias serial='microcom -f -p/dev/ttyUSB4 -s9600'
> 
> and then re-evaluate your .bashrc (which is done automatically
> on login):
> 
> . .bashrc
> 
> Now you have a new command.
> 
> 3. shell function
> 
> Most shells have functions available, too. The difference
> between an alias and a function is that an alias is just a
> substitution, but a function can take arguments and perform
> complicated feats of logic. In this case, a function is
> overkill, but it's still easy to drop in to your .bashrc.
> 
> function serial {
>     microcom -f -p/dev/ttyUSB4 -s9600
> }
> 
> 
> There you go.


Reco <recoverym4n@enotuniq.net> writes:
>         Hi.
> 
> Judging from the source it it should open a text file on your side (i.e.
> "x filename") and feed its contents line by line to the other side.
> So whatever you'll write in the file is specific to the device you're
> connecting to.
> 
> Reco

	I could have done a better job of frasing my question as
I love the power of unix and use shell scripts and aliases
all the time.

	What is confusing me about scripts in microcom is the
following situation:

	I wanted to output device-specific commands and at least
see the responses much like the send/expect pairs in the expect
utility or the OUTPUT and INPUT commands in kermit scripts.

	One starts the script while in the command mode of
microcom and it seems that your script should only contain
commands for microcom such as defining the port, speed, etc,
basically what the help screen says one can do.

	It doesn't seem like you can put device-specific commands
in the script file.

	I wrote a little script that exited command mode with the
exit command and then typed a command that was meant for the
device and then I typed x ./tester while in command mode.

	It ran the "exit" command which put one in the terminal
window.  You could type things then and each thing you type went
right to the device.  I then removed the exit command and left a
command for the device.

	It interpreted that command as being meant for microcom
so did not do anything but respond that it did not understand the
command.

	microcom does work with expect but can't see the Carriage
Returns at the end of the lines returned by the device.  If you
know how the response should end, expect does see the ASCII
characters and moves on.  Otherwise, one must allow a reasonable
time such as 1 second for the timeout.

	I was hoping there was some way to duplicate expect or
kermit with just the microcom app but this is not a show stopper
at all.  At least there is still a serial terminal that can talk
to devices whose only connection to the outside world is a RS-232
cable.

	Again, thanks for everybody's help.

Martin McCormick


Reply to: