One of my assignments in to write my own UNIX Shell. To receive input from the user, I am using fgets to capture the input as a string but I\'m not really sure how it works.
fgets considers the line terminator as a valid character. That's the extra character you are receiving.
fgets
Just do something like command[strlen(command) - 1] = '\0'; to remove the line terminator. Then you are free to do all your strcmp's.
command[strlen(command) - 1] = '\0';
strcmp