Martin McCormick wrote: 
> * x - execute a script
> 
>       Everything seems to work as far as I can tell but what
> does a script look like?

man runscript

>       The unix convention of typing the Up-Arrow and starting
> microcom is very handy since one does not have to type
> 
> microcom -f -p/dev/ttyUSB4 -s9600
> each time.  Actually, I usually get away with !mic followed by
> Enter and it starts.  Good work to everybody who created this
> useful little terminal program.

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.

-dsr-

Reply via email to