1RUNSCRIPT(1)                General Commands Manual               RUNSCRIPT(1)
2
3
4

NAME

6       runscript - script interpreter for minicom
7

SYNOPSIS

9       runscript scriptname [logfile [homedir]]
10

DESCRIPTION

12       runscript is a simple script interpreter that can be called from within
13       the minicom communications program to automate tasks like logging in to
14       a Unix system or your favorite BBS.
15

INVOCATION

17       The  program  expects  a  script name and optionally a filename and the
18       user's home directory as arguments, and it expects that it's input  and
19       output are connected to the "remote end", the system you are connecting
20       to. All messages from runscript meant for the local screen are directed
21       to  the  stderr  output. All this is automatically taken care of if you
22       run it from minicom.  The logfile and  home  directory  parameters  are
23       only  used to tell the log command the name of the logfile and where to
24       write it. If the homedir is omitted, runscript uses the directory found
25       in the $HOME environment variable. If also the logfile name is omitted,
26       the log commands are ignored.
27

KEYWORDS

29       Runscript recognizes the following commands:
30
31            expect   send     goto     gosub    return   !<   !
32            exit     print    set      inc      dec      if   timeout
33            verbose  sleep    break    call     log
34
35

OVERVIEW OF KEYWORDS

37       send <string>
38            <string> is sent to the modem. It is followed by a '\r'.  <string>
39            can be:
40              - regular text, e.g. 'send hello'
41              - text enclosed in quotes, e.g. 'send "hello world"'
42
43            Within <string> the following sequences are recognized:
44                \n - newline
45                \r - carriage return
46                \a - bell
47                \b - backspace
48                \c - don't send the default '\r'.
49                \f - formfeed
50                \^ - the ^ character
51                \o - send character o (o is an octal number)
52
53            Control characters can be used in the string with the ^ prefix (^A
54            to ^Z, ^[, ^ ^], ^^ and ^_). If you need to send the ^  character,
55            you must prefix it with the \ escape character.
56            Octal characters are either four-digit or delimited by a non-digit
57            character, e.g. the null character may  be  sent  with  \0000  and
58            'send 1234' is equivalent to 'send \0061234'.
59            Also  $(environment_variable)  can  be  used, for example $(TERM).
60            Minicom passes  three  special  environment  variables:  $(LOGIN),
61            which  is the username, $(PASS), which is the password, as defined
62            in the proper entry of the dialing directory, and $(TERMLIN) which
63            is  the  number  of actual terminal lines on your screen (that is,
64            the statusline excluded).
65
66       print <string>
67            Prints <string> to the local screen. Default followed  by  '\r\n'.
68            See the description of 'send' above.
69
70       label:
71            Declares  a  label (with the name 'label') to use with goto or go‐
72            sub.
73
74       goto <label>
75            Jump to another place in the program.
76
77       gosub <label>
78            Jumps to another place in the program. When the statement 'return'
79            is  encountered, control returns to the statement after the gosub.
80            Gosub's can be nested.
81
82       return
83            Return from a gosub.
84
85       ! <command>
86            Runs a shell for you in which 'command' is  executed.  On  return,
87            the  variable  '$?'  is set to the exit status of this command, so
88            you can subsequently test it using 'if'.
89
90       !< <command>
91            Runs a shell for you in which 'command' is  executed.  The  stdout
92            output  of the command execution will be sent to the modem. On re‐
93            turn, the variable '$?' is set to the exit status of this command,
94            so you can subsequently test it using 'if'.
95
96       exit [value]
97            Exit from "runscript" with an optional exit status. (default 1)
98
99       set <variable> <value>
100            Sets the value of <variable> (which is a single letter a-z) to the
101            value <value>. If <variable> does not exist, it will  be  created.
102            <value> can be a integer value or another variable.
103
104       inc <variable>
105            Increments the value of <variable> by one.
106
107       dec <variable>
108            Decrements the value of <variable> by one.
109
110       if <value> <operator> <value> <statement>
111            Conditional  execution  of <statement>. <operator> can be <, >, !=
112            or =.  Eg, 'if a > 3 goto exitlabel'.
113
114       timeout <value>
115            Sets the global timeout. By default, 'runscript' will  exit  after
116            120  seconds. This can be changed with this command. Warning: this
117            command acts differently within an 'expect'  statement,  but  more
118            about that later.
119
120       verbose <on|off>
121            By  default,  this is 'on'. That means that anything that is being
122            read from the modem by 'runscript', gets  echoed  to  the  screen.
123            This is so that you can see what 'runscript' is doing.
124
125       sleep <value>
126            Suspend execution for <value> seconds.
127
128       expect
129              expect {
130                pattern  [statement]
131                pattern  [statement]
132                [timeout <value> [statement] ]
133                ....
134              }
135            The  most  important command of all. Expect keeps reading from the
136            input until it reads a pattern that matches one of  the  specified
137            ones.   If expect encounters an optional statement after that pat‐
138            tern, it will execute it. Otherwise the default is to  just  break
139            out  of  the expect. 'pattern' is a string, just as in 'send' (see
140            above).  Normally, expect will timeout  in  60  seconds  and  just
141            exit, but this can be changed with the timeout command.
142
143       break
144            Break  out  of an 'expect' statement. This is normally only useful
145            as argument to 'timeout' within an expect, because the default ac‐
146            tion of timeout is to exit immediately.
147
148       call <scriptname>
149            Transfers  control  to  another script file. When that script file
150            finishes without errors, the original script will continue.
151
152       log <text>
153            Write text to the logfile.
154

NOTES

156       If you want to make your script to exit minicom (for example  when  you
157       use  minicom  to dial up your ISP, and then start a PPP or SLIP session
158       from a script), try the command "! killall  -9  minicom"  as  the  last
159       script  command.  The  -9 option should prevent minicom from hanging up
160       the line and resetting the modem before exiting.
161       Well, I don't think this is enough information to make you  an  experi‐
162       enced  'programmer'  in  'runscript', but together with the examples it
163       shouldn't be too hard to write some useful script files. Things will be
164       easier  if  you  have  experience  with BASIC.  The minicom source code
165       comes together with two example scripts, scriptdemo and unixlogin.  Es‐
166       pecially the last one is a good base to build on for your own scripts.
167

SEE ALSO

169       minicom(1)
170

BUGS

172       Runscript should be built in to minicom.
173

AUTHOR

175       Miquel   van   Smoorenburg,  <miquels@drinkel.ow.org>  Jukka  Lahtinen,
176       <walker@netsonic.fi>
177
178
179
180User's Manual            $Date: 2007-10-07 18:13:51 $             RUNSCRIPT(1)
Impressum