uTools-Manuals/docs/linux/dirname.html
2019-04-21 11:50:48 +08:00

23 lines
1.2 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<h1 id="dirname">dirname</h1>
<p>去除文件名中的非目录部分</p>
<h2 id="补充说明">补充说明</h2>
<p><strong>dirname命令</strong> 去除文件名中的非目录部分仅显示与目录有关的内容。dirname命令读取指定路径名保留最后一个<code>/</code>及其后面的字符,删除其他部分,并写结果到标准输出。如果最后一个<code>&lt;cite&gt;/&lt;/cite&gt;</code>后无字符dirname 命令使用倒数第二个<code>/</code>并忽略其后的所有字符。dirname 和 basename 通常在 shell 内部命令替换使用,以指定一个与指定输入文件名略有差异的输出文件名。</p>
<h3 id="语法">语法</h3>
<pre><code class="language-bash">dirname(选项)(参数)</code></pre>
<h3 id="选项">选项</h3>
<pre><code class="language-bash">--help显示帮助
--version显示版本号。</code></pre>
<h3 id="实例">实例</h3>
<pre><code class="language-bash">dirname //
结果为 /
dirname /a/b/
结果为:/a
dirname a
结果为 .
dirname a/b
结果为路径名 a</code></pre>
<!-- Linux命令行搜索引擎https://jaywcjlove.github.io/linux-command/ -->