file:檢視檔案内容類型的
file [FILE]....可以跟多個檔案
echo:回顯
echo [SHORT-OPTION]... [STRING]...
-n:不進行自動換行
-e:讓轉義符生效
(\n new line 換行)
(\t horizontal tab 制表符)
(\v vertical tab)
(\b backspace 删除前面的字元)
STRING可以使用引号,單引号和雙引号均可用:
單引号:強引用,變量引用不執行替換
~]#echo '$SHELL'
雙引号:弱引用,變量引用會被替換
~]#echo "$SHELL"
注意:變量引用的正規符号
${name}
指令示例:
示例:file檢視test
<code>[root@www zdw]</code><code># file test1</code>
<code>test1: directory</code>
示例:echo顯示
<code>[root@www ~]</code><code># echo "hello \nworld"</code>
<code>hello \nworld</code>
<code>[root@www ~]</code><code># echo -e "hello \nworld"</code>
<code>hello </code>
<code>world</code>
<code>[root@www ~]</code><code># echo -e "hello \tworld"</code>
<code>hello world</code>
<code>[root@www ~]</code><code># echo -e "hello \vworld"</code>
<code> </code><code>world</code>
<code>[root@www ~]</code><code># echo -e "hello \bworld"</code>
<code>helloworld</code>
<code>[root@www ~]</code><code># echo -e "hello\bworld"</code>
示例:輸出一個聲明的變量值
<code>[root@www zdw]</code><code># myname=zhaodongwei</code>
<code>[root@www zdw]</code><code># echo $myname</code>
<code>zhaodongwei</code>
<code></code>
本文轉自cix123 51CTO部落格,原文連結:http://blog.51cto.com/zhaodongwei/1851365,如需轉載請自行聯系原作者