shell.c code improvement