[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Omaha.pm] Re: [olug] Expect script help...




Can you show us what success looks like when you run through the entire process manually?

j


On Aug 26, 2004, at 11:53 AM, Daniel Linder wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Guy,

  Slightly off-topic but I figgured what the heck. :)

I am trying to automate login to a remote Unix system.  I have this
working when my laptop telnets directly to the remote system and the
expect script then ran a script on the remote server to set the $DISPLAY
variable.

The situation has changed and I now have to shell into an intermediate
unix system, then run "PowerBroker" to connect in to the final location.
When my script runs on the remote system now, it can only get the IP
address of the intermediate "PowerBroker" system but not my true
workstation.

Can some expect or Tcl guru give me some quick pointers to parse the
command output in the expect script to parse out my workstations IP
address so I can send it to a remote system?

Here is a snippet of my expect code:

  #!/usr/bin/expect
  #
  # Code to login to the first machine would be here...
  #
  send "who am i\n";
  # This returns:
  # linderd     pts/2     Aug 26 10:32   (10.120.15.88)
  set MYDISPLAY <what goes here?>
  #
  # Code to login to the second machine would be here...
  #
  # Now set my workstation DISPLAY variable...
  send "DISPLAY=[ $DISPLAY ]:0.0\n";

Thanks!

Dan