|
Packit |
15a96c |
.\" This file Copyright 1992,93,94 Miquel van Smoorenburg
|
|
Packit |
15a96c |
.\" 1998-2002 Jukka Lahtinen
|
|
Packit |
15a96c |
.\" It may be distributed under the GNU Public License, version 2, or
|
|
Packit |
15a96c |
.\" any higher version. See section COPYING of the GNU Public license
|
|
Packit |
15a96c |
.\" for conditions under which this file may be redistributed.
|
|
Packit |
15a96c |
.TH RUNSCRIPT 1 "$Date: 2007-10-07 18:13:51 $" "User's Manual"
|
|
Packit |
15a96c |
.SH NAME
|
|
Packit |
15a96c |
runscript \- script interpreter for minicom
|
|
Packit |
15a96c |
.SH SYNOPSIS
|
|
Packit |
15a96c |
.B runscript
|
|
Packit |
15a96c |
.RI "scriptname [logfile [homedir]]"
|
|
Packit |
15a96c |
.SH DESCRIPTION
|
|
Packit |
15a96c |
.B runscript
|
|
Packit |
15a96c |
is a simple script interpreter that can be called from within the minicom
|
|
Packit |
15a96c |
communications program to automate tasks like logging in to a Unix system
|
|
Packit |
15a96c |
or your favorite BBS.
|
|
Packit |
15a96c |
.SH INVOCATION
|
|
Packit |
15a96c |
The program expects a script name and optionally a filename and the
|
|
Packit |
15a96c |
user's home directory as arguments, and it expects that it's input and
|
|
Packit |
15a96c |
output are connected to the \^"remote end\^", the system you are
|
|
Packit |
15a96c |
connecting to. All messages from \fBrunscript\fP meant for the local screen
|
|
Packit |
15a96c |
are directed to the \fBstderr\fP output. All this is automatically taken
|
|
Packit |
15a96c |
care of if you run it from \fBminicom\fP.
|
|
Packit |
15a96c |
The logfile and home directory parameters are only used to tell the log
|
|
Packit |
15a96c |
command the name of the logfile and where to write it. If the homedir is
|
|
Packit |
15a96c |
omitted, runscript uses the directory found in the $HOME environment
|
|
Packit |
15a96c |
variable. If also the logfile name is omitted, the log commands are ignored.
|
|
Packit |
15a96c |
.SH KEYWORDS
|
|
Packit |
15a96c |
.TP 0.5i
|
|
Packit |
15a96c |
Runscript recognizes the following commands:
|
|
Packit |
15a96c |
.br
|
|
Packit |
15a96c |
.RS
|
|
Packit |
15a96c |
.nf
|
|
Packit |
15a96c |
|
|
Packit |
15a96c |
expect send goto gosub return \^!< \^!
|
|
Packit |
15a96c |
exit print set inc dec if timeout
|
|
Packit |
15a96c |
verbose sleep break call log
|
|
Packit |
15a96c |
|
|
Packit |
15a96c |
.fi
|
|
Packit |
15a96c |
.RE
|
|
Packit |
15a96c |
.SH "OVERVIEW OF KEYWORDS"
|
|
Packit |
15a96c |
.TP 0.5i
|
|
Packit |
15a96c |
.B "send <string>"
|
|
Packit |
15a96c |
<string> is sent to the modem. It is followed by a '\\r'.
|
|
Packit |
15a96c |
<string> can be:
|
|
Packit |
15a96c |
- regular text, e.g. 'send hello'
|
|
Packit |
15a96c |
- text enclosed in quotes, e.g. 'send \^"hello world\^"'
|
|
Packit |
15a96c |
.TP 0.5i
|
|
Packit |
15a96c |
Within <string> the following sequences are recognized:
|
|
Packit |
15a96c |
\\n - newline
|
|
Packit |
15a96c |
\\r - carriage return
|
|
Packit |
15a96c |
\\a - bell
|
|
Packit |
15a96c |
\\b - backspace
|
|
Packit |
15a96c |
\\c - don't send the default '\\r'.
|
|
Packit |
15a96c |
\\f - formfeed
|
|
Packit |
15a96c |
\\^ - the ^ character
|
|
Packit |
15a96c |
\\o - send character \fBo\fP (\fBo\fP is an octal number)
|
|
Packit |
15a96c |
|
|
Packit |
15a96c |
.br
|
|
Packit |
15a96c |
Control characters can be used in the string with the ^ prefix
|
|
Packit |
15a96c |
(^A to ^Z, ^[, ^\, ^], ^^ and ^_). If you need to send the ^ character,
|
|
Packit |
15a96c |
you must prefix it with the \\ escape character.
|
|
Packit |
15a96c |
.br
|
|
Packit |
15a96c |
Octal characters are either four-digit or delemited by a non-digit
|
|
Packit |
15a96c |
character, e.g. the null character may be sent with \\0000 and 'send
|
|
Packit |
15a96c |
1234' is equivalent to 'send \\0061234'.
|
|
Packit |
15a96c |
.br
|
|
Packit |
15a96c |
Also $(environment_variable) can be used, for example $(TERM).
|
|
Packit |
15a96c |
Minicom passes three special environment variables: $(LOGIN),
|
|
Packit |
15a96c |
which is the username, $(PASS), which is the password, as
|
|
Packit |
15a96c |
defined in the proper entry of the dialing directory, and
|
|
Packit |
15a96c |
$(TERMLIN) which is the number of actual terminal lines on your
|
|
Packit |
15a96c |
screen (that is, the statusline excluded).
|
|
Packit |
15a96c |
.TP 0.5i
|
|
Packit |
15a96c |
.B "print <string>"
|
|
Packit |
15a96c |
Prints <string> to the local screen. Default followed by '\\r\\n'.
|
|
Packit |
15a96c |
See the description of 'send' above.
|
|
Packit |
15a96c |
.TP 0.5i
|
|
Packit |
15a96c |
.B "label:"
|
|
Packit |
15a96c |
Declares a label (with the name 'label') to use with
|
|
Packit |
15a96c |
goto or gosub.
|
|
Packit |
15a96c |
.TP 0.5i
|
|
Packit |
15a96c |
.B "goto <label>"
|
|
Packit |
15a96c |
Jump to another place in the program.
|
|
Packit |
15a96c |
.TP 0.5i
|
|
Packit |
15a96c |
.B "gosub <label>"
|
|
Packit |
15a96c |
Jumps to another place in the program. When the statement 'return'
|
|
Packit |
15a96c |
is encountered, control returns to the statement after the gosub.
|
|
Packit |
15a96c |
Gosub's can be nested.
|
|
Packit |
15a96c |
.TP 0.5i
|
|
Packit |
15a96c |
.BR "return"
|
|
Packit |
15a96c |
Return from a gosub.
|
|
Packit |
15a96c |
.TP 0.5i
|
|
Packit |
15a96c |
.BR "! <command>"
|
|
Packit |
15a96c |
Runs a shell for you in which 'command' is executed. On return,
|
|
Packit |
15a96c |
the variable '$?' is set to the exit status of this command,
|
|
Packit |
15a96c |
so you can subsequently test it using 'if'.
|
|
Packit |
15a96c |
.TP 0.5i
|
|
Packit |
15a96c |
.BR "!< <command>"
|
|
Packit |
15a96c |
Runs a shell for you in which 'command' is executed. The stdout
|
|
Packit |
15a96c |
output of the command execution will be sent to the modem. On
|
|
Packit |
15a96c |
return, the variable '$?' is set to the exit status of this
|
|
Packit |
15a96c |
command, so you can subsequently test it using 'if'.
|
|
Packit |
15a96c |
.TP 0.5i
|
|
Packit |
15a96c |
.B "exit [value]"
|
|
Packit |
15a96c |
Exit from \^"runscript\^" with an optional exit status. (default 1)
|
|
Packit |
15a96c |
.TP 0.5i
|
|
Packit |
15a96c |
.B "set <variable> <value>"
|
|
Packit |
15a96c |
Sets the value of <variable> (which is a single letter a-z) to the
|
|
Packit |
15a96c |
value <value>. If <variable> does not exist, it will be created.
|
|
Packit |
15a96c |
<value> can be a integer value or another variable.
|
|
Packit |
15a96c |
.TP 0.5i
|
|
Packit |
15a96c |
.B "inc <variable>"
|
|
Packit |
15a96c |
Increments the value of <variable> by one.
|
|
Packit |
15a96c |
.TP 0.5i
|
|
Packit |
15a96c |
.B "dec <variable>"
|
|
Packit |
15a96c |
Decrements the value of <variable> by one.
|
|
Packit |
15a96c |
.TP 0.5i
|
|
Packit |
15a96c |
.B "if <value> <operator> <value> <statement>"
|
|
Packit |
15a96c |
Conditional execution of <statement>. <operator> can be <, >, != or =.
|
|
Packit |
15a96c |
Eg, 'if a > 3 goto exitlabel'.
|
|
Packit |
15a96c |
.TP 0.5i
|
|
Packit |
15a96c |
.B "timeout <value>"
|
|
Packit |
15a96c |
Sets the global timeout. By default, 'runscript' will exit after
|
|
Packit |
15a96c |
120 seconds. This can be changed with this command. Warning: this
|
|
Packit |
15a96c |
command acts differently within an 'expect' statement, but more
|
|
Packit |
15a96c |
about that later.
|
|
Packit |
15a96c |
.TP 0.5i
|
|
Packit |
15a96c |
.B "verbose <on|off>"
|
|
Packit |
15a96c |
By default, this is 'on'. That means that anything that is being
|
|
Packit |
15a96c |
read from the modem by 'runscript', gets echoed to the screen.
|
|
Packit |
15a96c |
This is so that you can see what 'runscript' is doing.
|
|
Packit |
15a96c |
.TP 0.5i
|
|
Packit |
15a96c |
.B "sleep <value>"
|
|
Packit |
15a96c |
Suspend execution for <value> seconds.
|
|
Packit |
15a96c |
.TP 0.5i
|
|
Packit |
15a96c |
.B "expect"
|
|
Packit |
15a96c |
.nf
|
|
Packit |
15a96c |
expect {
|
|
Packit |
15a96c |
pattern [statement]
|
|
Packit |
15a96c |
pattern [statement]
|
|
Packit |
15a96c |
[timeout <value> [statement] ]
|
|
Packit |
15a96c |
....
|
|
Packit |
15a96c |
}
|
|
Packit |
15a96c |
.fi
|
|
Packit |
15a96c |
The most important command of all. Expect keeps reading from the
|
|
Packit |
15a96c |
input until it reads a pattern that matches one of the
|
|
Packit |
15a96c |
specified ones. If expect encounters an optional statement
|
|
Packit |
15a96c |
after that pattern, it will execute it. Otherwise the default is
|
|
Packit |
15a96c |
to just break out of the expect. 'pattern' is a string, just as
|
|
Packit |
15a96c |
in 'send' (see above). Normally, expect will timeout in 60
|
|
Packit |
15a96c |
seconds and just exit, but this can be changed with the timeout
|
|
Packit |
15a96c |
command.
|
|
Packit |
15a96c |
.TP 0.5i
|
|
Packit |
15a96c |
.B "break"
|
|
Packit |
15a96c |
Break out of an 'expect' statement. This is normally only useful
|
|
Packit |
15a96c |
as argument to 'timeout' within an expect, because the default
|
|
Packit |
15a96c |
action of timeout is to exit immediately.
|
|
Packit |
15a96c |
.TP 0.5i
|
|
Packit |
15a96c |
.B "call <scriptname>"
|
|
Packit |
15a96c |
Transfers control to another scriptfile. When that scriptfile
|
|
Packit |
15a96c |
finishes without errors, the original script will continue.
|
|
Packit |
15a96c |
.TP 0.5i
|
|
Packit |
15a96c |
.B "log <text>"
|
|
Packit |
15a96c |
Write text to the logfile.
|
|
Packit |
15a96c |
.SH NOTES
|
|
Packit |
15a96c |
If you want to make your script to exit minicom (for example when
|
|
Packit |
15a96c |
you use minicom to dial up your ISP, and then start a PPP or SLIP
|
|
Packit |
15a96c |
session from a script), try the command "! killall \-9 minicom" as
|
|
Packit |
15a96c |
the last script command. The \-9 option should prevent minicom from
|
|
Packit |
15a96c |
hanging up the line and resetting the modem before exiting.
|
|
Packit |
15a96c |
.br
|
|
Packit |
15a96c |
.br
|
|
Packit |
15a96c |
Well, I don't think this is enough information to make you an
|
|
Packit |
15a96c |
experienced 'programmer' in 'runscript', but together with the
|
|
Packit |
15a96c |
examples it shouldn't be too hard to write some useful script
|
|
Packit |
15a96c |
files. Things will be easier if you have experience with BASIC.
|
|
Packit |
15a96c |
The \fBminicom\fP source code comes together with two example
|
|
Packit |
15a96c |
scripts, \fBscriptdemo\fP and \fBunixlogin\fP. Especially the
|
|
Packit |
15a96c |
last one is a good base to build on for your own scripts.
|
|
Packit |
15a96c |
.SH SEE ALSO
|
|
Packit |
15a96c |
.BR minicom (1)
|
|
Packit |
15a96c |
.SH BUGS
|
|
Packit |
15a96c |
Runscript should be built in to minicom.
|
|
Packit |
15a96c |
.SH AUTHOR
|
|
Packit |
15a96c |
Miquel van Smoorenburg, <miquels@drinkel.ow.org>
|
|
Packit |
15a96c |
Jukka Lahtinen, <walker@netsonic.fi>
|