[olug] Expect script help...

unfie at cox.net unfie at cox.net
Thu Aug 26 21:44:29 UTC 2004


If you have some web space (free or not), why not upload a text file upon connecting to the 'net that contains your ip, then have your .profile/whatever script download (wget or curl?) that file and export DISPLAY=`cat myip.txt` or something similar?

Although this kills some anominity, it has uses for other problems that might require knowing your IP.

-Will

> 
> From: "Daniel Linder" <dan at linder.org>
> Date: 2004/08/26 Thu PM 12:53:43 EDT
> To: olug at olug.org
> Subject: [olug] Expect script help...
> 
> -----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
> 
> - - - - -
> "I do not fear computer,
> I fear the lack of them."
>  -- Isaac Asimov
> 
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.1 (GNU/Linux)
> 
> iD8DBQFBLhWXNiBNyqUzGb8RAhfEAJ9IBkDLJoQDIvP+hVbfzZz7MjhhCACfbMaq
> QNTWa0G/JrBFQdq6BgECIWw=
> =h1Ct
> -----END PGP SIGNATURE-----
> _______________________________________________
> OLUG mailing list
> OLUG at olug.org
> http://lists.olug.org/mailman/listinfo/olug
> 




More information about the OLUG mailing list