You can make an emacs editing macro ("editing macros" are what the name "emacs" is derived from) and in the keyboard macro put commands that run Gnu Bash scripts or other shell programs and create scripts that query the user for Y or N answers.
So to create the macro, you'd do something like this:
Cx (
Mx new-frame return
Mx shell return (or just Mx eshell return--to use the emacs built-in shell)
bash <bash-program-that-queries-end-user-for-Y-or-N-answers> &
Mx delete-frame
Cx )
Save the macro and put it into an emacs lisp program that you load for reuse.
The macro would of course be usable from then on within emacs and/or you could run the whole thing as a batch file, from the command line, like any other program.
Other tools and suggestions: Look into emacs recursive-editing (which stops and re-starts macros and gives an end-user time to answer questions or even edit things) and the emacs built-in function message-or-box or just the message function. You could use tkquery (an easy to setup Tcl/Tk program that queries users for input data) and/or use zenity to make simple graphical interaction boxes that are easy to program and easy to use by end users.
You could create a question and answer routine in Gnu Make and run it inside Gnu Emacs. To do this and interact with a running Make session you'd could use process-send-string like this excerption from one of my makefiles:
echo "(process-send-string \"*compilation*\" \" \\n \") "
I mean, you could use the emacs process-send-string function to communicate and answer Y-or-N questions with a running Gnu Make program that is running inside a Gnu Emacs buffer.
Lastly, getting back to your question and your wondering why xterm -e <your-program>
is terminating quickly: You could just do things like emacs -l <emacs-lisp-file-with-question-and-answer-macro-in-it> & disown
and/or xterm -e <your-program-which-queries-the-end-users> & disown
. But this depends on how you want to run the program, as a synchronous or an asynchronous process; I mean, do you want to block the program from running while the end user answers the question(s) or not?
With these tools in hand I think you can get what you want with Gnu Emacs; and, since Gnu Emacs is extensible you can certainly get it to do what you want somehow--if you extend it by programming it yourself.