On Fri, Jun 01, 2001 at 11:52:33AM +0100, Andrew Nemchenko wrote:
> Yes I do have expect available, and I could use it, so if you can write it in expect..
> The reason that I dont use ssh, is because I dont want to set it up on every machine.
> While using a script like this, is fast and easy. Also I'm not worried about security
> since all these machines are on internal lan. Using ssh would just be too much of a
> hasle.

If you have a common home directory ssh would still be easier.
Also, as somebody else said rsh would be better than a script as
well.

So anyway, here's the script.  It should work ok. Its setup to
set password as argument to script.  That way your password isn't
sitting around in a file (but it still would be visible when you
call the script - which may be worse).  Change a couple of
lines to hard code the password.

-- 
Jim Crumley                  |
crumley at fields.space.umn.edu |
Work: 612 624-6804 or -0378  |

#!/usr/bin/expect -f
# Fix variables below as appropriate. To use type "scriptname password"

set host "krypton"
set display "111.111.111.111:0.0"
set user "dog"
# To harcode password, uncomment below
#set pass "chasecat"
# password is sent as argument to script, comment out for hardcoded password
set pass [lindex $argv 0]

spawn xhost +"$host"
spawn telnet "$host"

expect "ogin:"
send -- "$user\n"
expect  "ssword:"
send -- "$pass\n"

# could put an expect for the prompt here, but I don't know what your
# prompt looks like, so I'll sleep
sleep 1
system export DISPLAY="$display"
spawn sunapp

sleep 5
exit