Update shell.c

Fixed some problems in monads that Statix might not understand, like:
* numerous memory leaks
* sprintf is unsafe for copying overlapping objects.
* buffer overflows

Heh, and some people say I can't program in C... More work is needed on this program.