1)the command "dirname path" treats path as a pathnameand writes to the standard output the path prefix, that is everything up to but not including the last component. thus "dirname a/b/c/d" write a/b/c to standard output. If path is simple filename (has no / characters), then dirname writes a . to standard output. Implement "dirname" as a Korn Shell function. Make sure that it behaves sensibly when given values of path such as /.
2)implement the basename utility, which writes the last component of its pathname argument to standard output, as a Korn Shell function. For example
basename a/b/c/d
writes d to standard output.
3) The UNIX basename utility has an optional third argument. If you type suffix of path that is identical to suffix. For example
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.