2019-04-21 11:50:48 +08:00

17 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="unset">unset</h1>
<p>删除指定的shell变量或函数</p>
<h2 id="补充说明">补充说明</h2>
<p><strong>unset命令</strong> 用于删除已定义的shell变量包括环境变量和shell函数。unset命令不能够删除具有只读属性的shell变量和环境变量。</p>
<h3 id="语法">语法</h3>
<pre><code class="language-bash">unset(选项)(参数)</code></pre>
<h3 id="选项">选项</h3>
<pre><code class="language-bash">-f仅删除函数
-v仅删除变量。</code></pre>
<h3 id="参数">参数</h3>
<p>shell变量或函数指定要删除的shell变量或shell函数。</p>
<h3 id="实例">实例</h3>
<p>使用unset命令将前面所创建的环境变量mylove及其对应的值进行删除输入如下命令</p>
<pre><code class="language-bash">unset -v mylove #删除指定的环境变量</code></pre>
<p>执行以上命令后系统将删除指定的环境变量。用户可以使用env命令和grep命令对其进行查询。已经删除的环境变量再次使用指令查询时将出现查询不到指定环境变量的输出信息。</p>
<!-- Linux命令行搜索引擎https://jaywcjlove.github.io/linux-command/ -->