<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                # Shell test命令 Shell中的 test 命令用于檢查某個條件是否成立,它可以進行數值、字符和文件三個方面的測試。 ## 數值測試 | 參數 | 說明 | | --- | --- | | -eq | 等于則為真 | | -ne | 不等于則為真 | | -gt | 大于則為真 | | -ge | 大于等于則為真 | | -lt | 小于則為真 | | -le | 小于等于則為真 | 實例演示: ``` num1=100 num2=100 if test $[num1] -eq $[num2] then echo 'The two numbers are equal!' else echo 'The two numbers are not equal!' fi ``` 輸出結果: ``` The two numbers are equal! ``` ## 字符串測試 | 參數 | 說明 | | --- | --- | | = | 等于則為真 | | != | 不相等則為真 | | -z 字符串 | 字符串長度偽則為真 | | -n 字符串 | 字符串長度不偽則為真 | 實例演示: ``` num1=100 num2=100 if test num1=num2 then echo 'The two strings are equal!' else echo 'The two strings are not equal!' fi ``` 輸出結果: ``` The two strings are equal! ``` ## 文件測試 | 參數 | 說明 | | --- | --- | | -e 文件名 | 如果文件存在則為真 | | -r 文件名 | 如果文件存在且可讀則為真 | | -w 文件名 | 如果文件存在且可寫則為真 | | -x 文件名 | 如果文件存在且可執行則為真 | | -s 文件名 | 如果文件存在且至少有一個字符則為真 | | -d 文件名 | 如果文件存在且為目錄則為真 | | -f 文件名 | 如果文件存在且為普通文件則為真 | | -c 文件名 | 如果文件存在且為字符型特殊文件則為真 | | -b 文件名 | 如果文件存在且為塊特殊文件則為真 | 實例演示: ``` cd /bin if test -e ./bash then echo 'The file already exists!' else echo 'The file does not exists!' fi ``` 輸出結果: ``` The file already exists! ``` 另外,Shell還提供了與( ! )、或( -o )、非( -a )三個邏輯操作符用于將測試條件連接起來,其優先級為:"!"最高,"-a"次之,"-o"最低。例如: ``` cd /bin if test -e ./notFile -o ./bash then echo 'One file exists at least!' else echo 'Both dose not exists!' fi ``` 輸出結果: ``` One file exists at least! ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看