Run C shell with "rlogin" and/or "xterm" commands

Run C shell with "rlogin" and/or "xterm" commands

Post by Christopher Mulve » Thu, 18 Jul 2002 13:40:30



I'm attempting to create a shell script that performs a rlogin and continues
the rest of the script on the other terminal.  I'd also like to create a
script that opens an xterm and runs the rest of the script from there on the
same terminal.  Any suggestions or is this even possible.

Thanks!!!
Chris

 
 
 

Run C shell with "rlogin" and/or "xterm" commands

Post by those who know me have no need of my nam » Thu, 18 Jul 2002 23:49:55


in comp.unix.shell i read:

Quote:>I'm attempting to create a shell script that performs a rlogin and continues
>the rest of the script on the other terminal.  

feed the stuff you want done remotely to a remote shell, e.g.,

  #!/bin/sh
  rsh host sh -s <<EOS
  command ...
  command ...
  command ...
  exit
  EOS

also, you can use a different scripting language, e.g., expect, e.g.,

  #!/usr/local/bin/expect -f
  spawn rlogin host
  send "command ...\r"
  send "command ...\r"
  send "command ...\r"
  send "exit\r"
  expect eof

Quote:>I'd also like to create a script that opens an xterm and runs the rest of
>the script from there on the same terminal.

feed the stuff you want done by the xterm into a temporary file and tell
xterm to execute that file, e.g.,

  #!/bin/sh
  f=${TMPDIR:-/tmp}/foo$$
  trap 'rm -f $f' 0
  cat << EOS > $f
  command ...
  command ...
  command ...
  exit
  EOS
  xterm -e sh $f

if the xterm is to run on a remote host then you'll have to combine these
methods.

--
bringing you boring signatures for 17 years