Questions

1:Write a function that determines whether a command is located in one of the directories in $PATH. The command will be supplied as the first argument. If the command is located in one of the directories in $PATH, your function should print the full path to the command and return 0. Otherwise your function should return 1 and optionally print an error message.
2:Write a function to make a directory (and all of its parents) change to that directory and then print the full path of that directory. Please include error checking at all levels. Make sure that your function generates all of the error messages, rather than the commands that it executes.
3:Rewrite the function you wrote in Question 2 without using mkdir –p.
4:Enhance the readPass ...

Get Sams Teach Yourself Shell Programming in 24 Hours, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.