diff --git a/course-definition.yml b/course-definition.yml index d07f9a2..a29a7e4 100644 --- a/course-definition.yml +++ b/course-definition.yml @@ -312,9 +312,13 @@ stages: description_md: |- In this stage, you'll extend the `type` builtin to search for executable files using [PATH](https://en.wikipedia.org/wiki/PATH_(variable)). - [PATH](https://en.wikipedia.org/wiki/PATH_(variable)) is an environment variable that specifies a set of directories where executable programs are located. When a command is received, the program should search for the command in the directories listed in the PATH environment variable. + [PATH](https://en.wikipedia.org/wiki/PATH_(variable)) is an environment variable that specifies a set of directories where executable programs are located. When a command is received, your shell should search for the command in the directories listed in the PATH environment variable. - If the command is found, the program should print the path to the command. If the command is not found, the program should print `: not found`. + For example, if PATH is `/dir1:/dir2:/dir3`, your shell should search in `/dir1`, then `/dir2`, and finally `/dir3`, in that order. + + - If a matching file is found but it does not have execute permissions, your shell should skip it and continue searching. + - If a matching files is found and it has execute permissions, your shell should print the path to the file. + - If no matching files are found, your shell should print `: not found`. ### Tests @@ -341,8 +345,9 @@ stages: ### Notes - The actual value of the `PATH` environment variable will be random for each test case. - - `PATH` can contain multiple directories separated by colons (`:`), your program should search for programs in each directory in order and return the first match which has executable permissions. - Some commands, such as `echo`, can exist as both builtin commands and executable files. In such cases, the `type` command should identify them as builtins. + - PATH can include directories that don’t exist on disk, so your code should handle such cases gracefully. + marketing_md: |- In this stage, you'll implement the `type` builtin command for your shell. @@ -1120,8 +1125,11 @@ stages: 1. **Input:** `custom` * The tester types "custom" and presses ``. The tester expects that the prompt line changes to custom_executable . - The tester will verify that your shell correctly completes the command to the external executable file name. - Note the space at the end of the completion. + The tester will verify that your shell correctly completes the command to the external executable file name. Note the space at the end of the completion. + + ### Notes + + - PATH can include directories that don't exist on disk, so your code should handle such cases gracefully. marketing_md: |- In this stage, you'll implement support for autocompleting external executables.