hi, I need to switch users in a script
I'm newbee to expect
I wrote two files
1 sudo.exp, since su4098 is used as root in my laptop
#!/usr/bin/expect
spawn su su4098
expect *Password:*
send mypsw\n
interact
2 test.sh
ls
./sudo.exp
tcpdump -i wlan0
su esolve
ls
however, in test.sh
when it switches to su4098,namely the root
it stops a while
and tens of seconds later, it run the password as a command
and the following commands: tcpdump, su esolve, and ls are not run
what is wrong with my scripts?
thanks!