| 1 |
.TH DISLOCATE 1 "7 October 1993" |
| 2 |
.SH NAME |
| 3 |
Dislocate \- disconnect and reconnect processes |
| 4 |
.SH SYNOPSIS |
| 5 |
.B dislocate |
| 6 |
[ |
| 7 |
.I program args... |
| 8 |
] |
| 9 |
.SH INTRODUCTION |
| 10 |
.B Dislocate |
| 11 |
allows processes to be disconnected and reconnected to the terminal. |
| 12 |
Possible uses: |
| 13 |
.RS |
| 14 |
.TP 4 |
| 15 |
\(bu |
| 16 |
You can disconnect a process from a terminal at work |
| 17 |
and reconnect from home, to continue working. |
| 18 |
.TP 4 |
| 19 |
\(bu |
| 20 |
After having your line be dropped due to noise, you can get back to your |
| 21 |
process without having to restart it from scratch. |
| 22 |
.TP 4 |
| 23 |
\(bu |
| 24 |
If you have a problem that you would like to show someone, you can set |
| 25 |
up the scenario at your own terminal, disconnect, walk down the hall, |
| 26 |
and reconnect on another terminal. |
| 27 |
.TP 4 |
| 28 |
\(bu |
| 29 |
If you are in the middle of a great game (or whatever) that does not allow |
| 30 |
you to save, and someone else kicks you off the terminal, you can disconnect, |
| 31 |
and reconnect later. |
| 32 |
.SH USAGE |
| 33 |
When run with no arguments, |
| 34 |
.B Dislocate |
| 35 |
tells you about your disconnected processes and lets you reconnect to one. |
| 36 |
Otherwise, |
| 37 |
.B Dislocate |
| 38 |
runs the named program along with any arguments. |
| 39 |
|
| 40 |
By default, ^] is an escape that lets you talk to |
| 41 |
.B Dislocate |
| 42 |
itself. At that point, you can disconnect (by pressing ^D) or |
| 43 |
suspend |
| 44 |
.B Dislocate |
| 45 |
(by pressing ^Z). |
| 46 |
|
| 47 |
Any Tcl or Expect command is also acceptable at this point. |
| 48 |
For example, |
| 49 |
to insert the contents of a the file /etc/motd as if you had typed it, say: |
| 50 |
.nf |
| 51 |
|
| 52 |
send -i $out [exec cat /etc/motd] |
| 53 |
|
| 54 |
.fi |
| 55 |
|
| 56 |
To send the numbers 1 to 100 in response to the prompt "next #", say: |
| 57 |
.nf |
| 58 |
|
| 59 |
for {set i 0} {$i<100} {incr i} { |
| 60 |
expect -i $in "next #" |
| 61 |
send -i $out "$i\\r" |
| 62 |
} |
| 63 |
.fi |
| 64 |
|
| 65 |
Scripts can also be prepared and sourced in so that you don't have to |
| 66 |
type them on the spot. |
| 67 |
|
| 68 |
.B Dislocate |
| 69 |
is actually just a simple |
| 70 |
.B Expect |
| 71 |
script. Feel free to make it do what you want it to do or just |
| 72 |
use |
| 73 |
.B Expect |
| 74 |
directly, without going through |
| 75 |
.BR Dislocate . |
| 76 |
.B Dislocate |
| 77 |
understands a few special arguments. These should appear before any program |
| 78 |
name. Each should be separated by whitespace. If the arguments themselves |
| 79 |
takes arguments, these should also be separated by whitespace. |
| 80 |
.PP |
| 81 |
The |
| 82 |
.B \-escape |
| 83 |
flag sets the escape to whatever follows. The default escape is ^]. |
| 84 |
.PP |
| 85 |
.SH CAVEATS |
| 86 |
This program was written by the author as an exercise to show that |
| 87 |
communicating with disconnected processes is easy. There are |
| 88 |
many features that could be added, but that is not the intent of this |
| 89 |
program. |
| 90 |
|
| 91 |
.SH SEE ALSO |
| 92 |
.BR Tcl (3), |
| 93 |
.BR libexpect (3) |
| 94 |
.br |
| 95 |
.I |
| 96 |
"Exploring Expect: A Tcl-Based Toolkit for Automating Interactive Programs" |
| 97 |
\fRby Don Libes, |
| 98 |
O'Reilly and Associates, January 1995. |
| 99 |
.SH AUTHOR |
| 100 |
Don Libes, National Institute of Standards and Technology |