start to STAR

2012年7月22日 星期日

Bash Script - Read file for bash



[Method 1]
read -p "Please enter your file name: "  file
cat $file | while read line
do
    echo "Line ${line[$i]}"
    #印出file內的所有欄位
done
[Method 2]
read -p "file name: " file_name
while read line
do
    echo "${line}"
done < $file_name
於 晚上10:48
標籤: Bash Script
較新的文章 較舊的文章 首頁

搜尋此網誌

標籤

  • Bash Script
  • Git
  • Python
  • Sublime
  • Ubuntu
  • Windows

網誌存檔

  • ►  2021 (2)
    • ►  2月 (1)
    • ►  1月 (1)
  • ►  2020 (3)
    • ►  5月 (1)
    • ►  4月 (2)
  • ►  2019 (1)
    • ►  9月 (1)
  • ►  2017 (1)
    • ►  11月 (1)
  • ►  2016 (2)
    • ►  12月 (1)
    • ►  6月 (1)
  • ▼  2012 (11)
    • ►  8月 (1)
    • ▼  7月 (10)
      • Bash Script - default value
      • Bash Script - Random select element from array
      • Bash Script - check argument in array
      • Bash Script - 陣列及for迴圈範例
      • Ubuntu - 列出所有相關process, 排除字元, 捷取欄位, kill process
      • Ubuntu - MD5 generate and check
      • Windows - Bat Script - for 迴圈 (由0印到10)
      • Ubuntu - Some Linux Command
      • Bash Script - Read file for bash
      • Bash Script - If...Else
頂尖企業主題. 技術提供:Blogger.