make commands array into file scope variable and reorganize shell.c