mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-10-11 08:53:20 +08:00
语法高亮,滚动条美化,设置页面调整
This commit is contained in:
@@ -3,34 +3,34 @@
|
||||
<h2 id="补充说明">补充说明</h2>
|
||||
<p><strong>stty命令</strong> 修改终端命令行的相关设置。</p>
|
||||
<h3 id="语法">语法</h3>
|
||||
<pre><code>stty(选项)(参数)</code></pre>
|
||||
<pre><code class="language-bash">stty(选项)(参数)</code></pre>
|
||||
<h3 id="选项">选项</h3>
|
||||
<pre><code>-a:以容易阅读的方式打印当前的所有配置;
|
||||
<pre><code class="language-bash">-a:以容易阅读的方式打印当前的所有配置;
|
||||
-g:以stty可读方式打印当前的所有配置。</code></pre>
|
||||
<h3 id="参数">参数</h3>
|
||||
<p>终端设置:指定终端命令行的设置选项。</p>
|
||||
<h3 id="实例">实例</h3>
|
||||
<p><strong>在命令行下,禁止输出大写的方法:</strong></p>
|
||||
<pre><code>stty iuclc #开启
|
||||
<pre><code class="language-bash">stty iuclc #开启
|
||||
stty -iuclc #恢复</code></pre>
|
||||
<p><strong>在命令行下禁止输出小写:</strong></p>
|
||||
<pre><code>stty olcuc #开启
|
||||
<pre><code class="language-bash">stty olcuc #开启
|
||||
stty -olcuc #恢复</code></pre>
|
||||
<p><strong>打印出终端的行数和列数:</strong></p>
|
||||
<pre><code>stty size</code></pre>
|
||||
<pre><code class="language-bash">stty size</code></pre>
|
||||
<p><strong>改变Ctrl+D的方法:</strong></p>
|
||||
<pre><code>stty eof "string"</code></pre>
|
||||
<pre><code class="language-bash">stty eof "string"</code></pre>
|
||||
<p>系统默认是Ctrl+D来表示文件的结束,而通过这种方法,可以改变!</p>
|
||||
<p><strong>屏蔽显示:</strong></p>
|
||||
<pre><code>stty -echo #禁止回显
|
||||
<pre><code class="language-bash">stty -echo #禁止回显
|
||||
stty echo #打开回显</code></pre>
|
||||
<p>测试方法:</p>
|
||||
<pre><code>stty -echo;read;stty echo;read</code></pre>
|
||||
<pre><code class="language-bash">stty -echo;read;stty echo;read</code></pre>
|
||||
<p><strong>忽略回车符:</strong></p>
|
||||
<pre><code>stty igncr #开启
|
||||
<pre><code class="language-bash">stty igncr #开启
|
||||
stty -igncr #恢复</code></pre>
|
||||
<p><strong>定时输入:</strong></p>
|
||||
<pre><code>timeout_read()
|
||||
<pre><code class="language-bash">timeout_read()
|
||||
{
|
||||
timeout=$1
|
||||
old_stty_settings=`stty -g` #save current settings
|
||||
@@ -39,5 +39,5 @@ stty -igncr #恢复</code></pre>
|
||||
stty "$old_stty_settings" #recover settings
|
||||
}</code></pre>
|
||||
<p>更简单的方法就是利用read命令的<code>-t</code>选项:</p>
|
||||
<pre><code>read -t 10 varname</code></pre>
|
||||
<pre><code class="language-bash">read -t 10 varname</code></pre>
|
||||
<!-- Linux命令行搜索引擎:https://jaywcjlove.github.io/linux-command/ -->
|
||||
|
Reference in New Issue
Block a user