0

From a shell script, how can I launch a bash sub-shell for the user & wait for the user to type exit at the bash sub-shell prompt?

I tried bash -c expect -c 'expect "exit" {send "Exiting\n"}'; but it is not working. Please help.

Thanks

1 Answer 1

0

I don't understand what you expect "expect" to be:

$ type -a expect
bash: type: expect: not found

Here a simple example that might give clues:

$ bash -c 'echo "Hi, I am alive." ; read -p "Press ENTER to exit> " ans ; echo "You typed $ans"' 
Hi, I am alive.
Press ENTER to exit> exit
You typed exit

man bash, help read and the Bash guides at http://www.tldp.org/guides.html might be of help.

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.