Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #221062

Re: Microcom; What's this Script Feature?

Path csiph.com!4.us.feeder.erje.net!3.eu.feeder.erje.net!feeder.erje.net!news.albasani.net!tahina.priv.at!bofh.it!news.nic.it!robomod
From Dan Ritter <dsr@randomstring.org>
Newsgroups linux.debian.user
Subject Re: Microcom; What's this Script Feature?
Date Tue, 07 Apr 2020 15:50:02 +0200
Message-ID <zSWM2-dG-7@gated-at.bofh.it> (permalink)
References <zSW9j-8sG-5@gated-at.bofh.it>
X-Original-To Martin McCormick <martin.m@suddenlink.net>
X-Mailbox-Line From debian-user-request@lists.debian.org Tue Apr 7 13:45:42 2020
Old-Return-Path <dsr@randomstring.org>
X-Amavis-Spam-Status No, score=-7 tagged_above=-10000 required=5.3 tests=[BAYES_00=-2, LDO_WHITELIST=-5] autolearn=ham autolearn_force=no
X-Policyd-Weight using cached result; rate: -4.6
X-Helo mail.randomstring.org
Authentication-Results proxy; auth=none
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
X-Message-Flag Cannot contact reaper.nsa.gov. Trying bucket.cia.gov..
X-Clacks-Overhead GNU Terry Pratchett
X-Mailing-List <debian-user@lists.debian.org> archive/latest/761304
List-ID <debian-user.lists.debian.org>
List-URL <https://lists.debian.org/debian-user/>
List-Archive https://lists.debian.org/msgid-search/20200407134528.GD19608@randomstring.org
Approved robomod@news.nic.it
Lines 65
Organization linux.* mail to news gateway
Sender robomod@news.nic.it
X-Original-Cc debian-user@lists.debian.org
X-Original-Date Tue, 7 Apr 2020 09:45:28 -0400
X-Original-Message-ID <20200407134528.GD19608@randomstring.org>
X-Original-References <E1jLnxr-0003F8-0c@wb5agz>
Xref csiph.com linux.debian.user:221062

Show key headers only | View raw


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-

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Microcom; What's this Script Feature? "Martin McCormick" <martin.m@suddenlink.net> - 2020-04-07 15:10 +0200
  Re: Microcom; What's this Script Feature? Dan Ritter <dsr@randomstring.org> - 2020-04-07 15:50 +0200
  Re: Microcom; What's this Script Feature? Reco <recoverym4n@enotuniq.net> - 2020-04-07 16:10 +0200
    Re: Microcom; What's this Script Feature? "Martin McCormick" <martin.m@suddenlink.net> - 2020-04-07 18:50 +0200

csiph-web