It is currently Thu, 20 Jan 2022 10:22:34 GMT

Author Message
 How to emulate terminals waiting for commands ?

I want to write a interpreter using ksh, the sample
file needs to be interpreted is something like:

TERM Label1 user1 mach1
TERM Label2 user2 mach2

    uname -a
    ... // other Unix commands

Whenever a line with "TERM" at the beginning is read
from the input, the interpreter should be able to emulate
that someone has logged in some machine and started
a session terminal... Take the line "TERM Label1 user1
mach1" for example, the interpreter will "open" a terminal
for user1 at mach1, and labeling this terminal as "Label1",
waiting for commands input ...

Then, all commands below "Label1" are executed in this
terminal ...

I think Unix shell can meet this need. But I have no
idea.  Anyone has a good idea about the implementation
in ksh?

 Fri, 08 Sep 2006 20:27:09 GMT   
 How to emulate terminals waiting for commands ?

SPC=" "
TAB="      "

while IFS= read -r line
  case $line in
      TERM*) open_term ;;      ## set up terminal emulation
      $SPC*|$TAB*) do_term ;;  ## execute line
      "") ;;                   ## empty line: do nothing
      *) term=$line ;;         ## subsequent lines executed by $term
done < FILE

    I don't know just what you mean by "emulate that someone has
    logged in", and executing commands in "this terminal", so you need
    to write the functions open_term() to set up the terminal, and
    do_term() to execute the commands.

    Post here with your code and specific problems.

    Chris F.A. Johnson        
    My code (if any) in this post is copyright 2004, Chris F.A. Johnson
    and may be copied under the terms of the GNU General Public License

 Mon, 11 Sep 2006 03:41:23 GMT   
   [ 2 post ] 

Similar Threads

1. command(s) that emulate Solaris prtdiag command

2. fork,exec and wait and wait and wait and wait

3. Command to wait for previous process/command to finish

4. Help with serial line to PC emulating terminal

5. Emulating Multiple Terminals

6. Emulate X-terminal by PC ?

7. Is there any way to emulate X-terminal?

8. Is there any way to emulate X-terminal?

9. can mac emulate a terminal on unix system

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software