72 lines
1.2 KiB
HTML
72 lines
1.2 KiB
HTML
<HTML>
|
|
<HEAD>
|
|
<TITLE>basename(1)</TITLE>
|
|
</HEAD>
|
|
<BODY>
|
|
<H1>basename(1)</H1>
|
|
<HR>
|
|
<PRE>
|
|
|
|
</PRE>
|
|
<H2>NAME</H2><PRE>
|
|
basename, dirname - strip off file prefixes and suffixes
|
|
|
|
|
|
</PRE>
|
|
<H2>SYNOPSIS</H2><PRE>
|
|
<STRONG>basename</STRONG> <EM>file</EM> [<EM>suffix</EM>]
|
|
<STRONG>dirname</STRONG> <EM>file</EM>
|
|
|
|
|
|
</PRE>
|
|
<H2>OPTIONS</H2><PRE>
|
|
(none)
|
|
|
|
|
|
</PRE>
|
|
<H2>EXAMPLES</H2><PRE>
|
|
|
|
<STRONG>basename</STRONG> <STRONG>/user/ast/file.c</STRONG>
|
|
# Strips path to yield <EM>file</EM>.<EM>c</EM>
|
|
|
|
<STRONG>basename</STRONG> <STRONG>/user/file.c</STRONG> <STRONG>.c</STRONG>
|
|
# Strips path and .<EM>c</EM> to yield <EM>file</EM>
|
|
|
|
<STRONG>dirname</STRONG> <STRONG>/user/file.c</STRONG>
|
|
# Strips basename to yield /<EM>user</EM>
|
|
|
|
|
|
</PRE>
|
|
<H2>DESCRIPTION</H2><PRE>
|
|
|
|
<EM>Basename</EM> removes the initial directory names (if any) yielding the name
|
|
of the file itself. If a second argument is present, it is interpreted
|
|
as a suffix and is also stripped, if present.
|
|
|
|
<EM>Dirname</EM> removes the final component of a path, yielding the directory a
|
|
file is in.
|
|
|
|
These programs are primarily used in shell scripts.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</PRE>
|
|
</BODY>
|
|
</HTML>
|