
     shell :-  shell_prompt, read(Goal), shell(Goal).

     shell(exit) :- !.
     shell(Goal) :-
        ground(Goal), !, shell_solve_ground(Goal), shell. 
     shell(Goal) :- 
        shell_solve(Goal), shell.

     shell_solve(Goal) :-
	Goal, write(Goal), nl, fail.
     shell_solve(Goal) :- 
        write('No (more) solutions'), nl.
     
     shell_solve_ground(Goal) :- 
		Goal, !, write('Yes'), nl.
     shell_solve_ground(Goal) :- 
		write('No'), nl.
          
     shell_prompt :-  write('Next command? ').

%	Program 12.6    An interactive shell
