Unix: dirname and basename 

Joined:
04/09/2007
Posts:
727

May 31, 2007 01:58:44    Last update: May 31, 2007 01:58:44
Use basename to get the base name of a path. Use dirname to get the path excluding base name.

For example:
basename /export/home/user123/file1   # sends file1 to stdout

dirname /export/home/user123/file1    # sends /export/home/user123 to stdout
Share |
| Comment  | Tags
 
Easy email testing with http://www.ximailstop.com