I am supposed to validate user input in a way that the user does not enter any non-existent command. For instance, emacs, kill, jobs, are all valid commands. One way I thought of doing this is to have a if statement that would print out a message telling the user in case any of the valid commands is not entered. This is what I mean.
However, they are not all the commands. I do realize there are a whole bunch of valid commands that a user can input. What other way could I use in order to validate input without having an extremely long if statement that is going to check for other valid commands like eval, fg and so on.
PS: This is part of a shell program that I am writing in C