I'm trying to write a problem which can display a prompt,e.g My_shell$ and accept a command entered by the user by using fgets. Also, it needs to execute the command by invoking fork() and execvp() system call. Then, if user type "logout", the shell should exit.

My problem is that I don't know how to combine fgets, fork() and execvp() together inside the program.
Can anyone please show me some examples or suggestions?
Thank you