Before I start, two things.
1) Yes I know it's bad practice and obomination to all things holy, but I'm not a sys admin at JP Morgan, I'm a hobbyist tooling about in a VM, in my pants, at home.
2) If you are just going to flame for even considering hardcoding a root password, thanks, I get it.
So here goes.
I have the following script:
#!/bin/bash
clear
echo
whoami
echo
PASS="1234"
expect -c "spawn su
expect -nocase \"password:\" {send \"$PASS\r\" ; interact ; whoami }"
#Scripts exits at this point
echo -ne "Name: "
read name
echo
echo $name
It works fine in that it enters the password and elevates the privileges of the user.
The problem is that it then exits at the marked point and does not continue to the code below.
Any ideas why this is?
Running Backbox 64 Bit in VMPlayer