using expect to switch users in a script
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
spawn su su4098
however, in test.sh
tcpdump -i wlan0
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?
besides, how to share variables between users in a script?