Re: Logon script



On 25 Oct 2006 10:35:58 -0700, nicetom786@xxxxxxxxx
<nicetom786@xxxxxxxxx> wrote:
I did use expect and it prompts me for the password.
This should work right?

su - user1
expect "Password: "
send "xyz"

expect "string" and send "string" are expect commands, not shell
commands, and you would have them executed after su returns. You can
write a script like this:

#!/usr/bin/expect -f
spawn su - user1
expect "Password:"
send "xyz"
interact


--
BOFH excuse #348:
We're on Token Ring, and it looks like the token got loose.
.



Relevant Pages

  • Re: Logon script
    ... I get this error after I changed to spawn and then send and expect. ... send "xyz" ... spawn su - user1 ... We're on Token Ring, and it looks like the token got loose. ...
    (comp.unix.questions)
  • Re: Logon script
    ... I did use expect and it prompts me for the password. ... su - user1 ... send "xyz" ... Bill Marcum wrote: ...
    (comp.unix.questions)