久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      SHELL 讀取文件的每一行內(nèi)容并輸出

      假設(shè)讀取的文件為當(dāng)期目錄下的 test.txt 文件,內(nèi)容如下:

      Google   Runoob  Taobao

      實(shí)例 1

      #!/bin/bash

      while read line
      do
          echo $line
      done < test.txt

      執(zhí)行輸出結(jié)果為:

      Google  Runoob  Taobao

      實(shí)例 2

      #!/bin/bash

      cat test.txt | while read line
      do
          echo $line
      done

      執(zhí)行輸出結(jié)果為:

      Google  Runoob  Taobao

      實(shí)例 3

      for line in `cat  test.txt`
      do
          echo $line
      done

      執(zhí)行輸出結(jié)果為:

      Google  Runoob  Taobao

      for 逐行讀和 while 逐行讀是有區(qū)別的,如:

      $ cat test.txt
      Google
      Runoob
      Taobao

      $ cat test.txt | while read line; do echo $line; done
      Google
      Runoob
      Taobao

      $ for line in $(<test.txt); do echo $line; done
      Google
      Runoob
      Taobao

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號