ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzahz_5.4.0.1/dirname.htm

86 lines
2.2 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org">
<meta http-equiv="Content-Type" content=
"text/html; charset=utf-8">
<title>dirname - Return directory portion of path name</title>
<LINK rel="stylesheet" type="text/css" href="../rzahg/ic.css">
</HEAD>
<body bgcolor="#FFFFFF">
<!-- Java sync-link -->
<SCRIPT LANGUAGE="Javascript" SRC="../rzahg/synch.js" TYPE="text/javascript"></SCRIPT>
<h2>dirname - Return directory portion of path name</h2>
<strong>Synopsis</strong>
<p><strong>dirname</strong> <em>string</em></p>
<p><strong>Description</strong></p>
<p>You can use <strong>dirname</strong> to delete the filename
portion, beginning with the last slash character (/) to the end of
<em>string</em>, and write the result to standard output. The <em>
string</em> is processed using the following rules:</p>
<ul>
<li>If <em>string</em> consists entirely of slash characters, a
single slash character is written to standard output and processing
ends.</li>
<li>If there are any trailing slash characters in <em>string</em>,
they are removed.</li>
<li>If there are no slash characters remaining in <em>string</em>,
a period character is written to standard output and processing
ends.</li>
<li>If there are trailing non-slash characters in <em>string</em>,
they are removed.</li>
<li>If there are any trailing slash characters in <em>string</em>,
they are removed.</li>
<li>If the remaining string is empty, <em>string</em> is set to a
single slash character.</li>
</ul>
<p><strong>Operands</strong></p>
<p>The <em>string</em> operand is the pathname of which <strong>
dirname</strong> will return the directory portion of.</p>
<p><strong>Exit Status</strong></p>
<ul>
<li>0 on success</li>
<li>&gt;0 if an error occurs.</li>
</ul>
<p><strong>Related information</strong></p>
<ul>
<li><a href="basename.htm">basename - Return directory portion of
path name</a></li>
</ul>
<strong>Examples</strong>
<ol>
<li>Set the shell variable FOO to "/usr/bin".
<pre>
FOO=$(dirname /usr/bin/trail)
</pre>
</li>
</ol>
<!-- end ibmbody========================================================= -->
</body>
</html>