how it knows , valid_command is present atvalid_command is /usr/local/bin/valid_command
, from ``PATH=“/usr/bin:/usr/local/bin:$PATH” ./your_program.sh
Hey @PrakharMNNIT, it basically comes down to two steps:
- Split the PATH variable into a list of directories.
- Iterate over each directory in that list and check for the command.
Let me know if you’d like further clarification!
1 Like
This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.