Shell

Create a program named shell.c that executes an infinite loop and while in the loop

  1. Prints “$” to stdout
  2. Reads a filename from stdin
  3. If the filename is an executable in one of the directories listed in the PATH environmental variable or is in the current working directory then the program creates a child process and executes the filename using an exec method.  The parent process should wait for the child process to terminate before continuing in the loop.
  4. If the filename is not executable or is not found the program prints “invalid file name”.

© 2017, Eric. All rights reserved.