Shell scripts that perform fast and easy to understand code. In the process of writing shell code, it is often used to read the file contents. Notation One:----------------------------------------------------------------------------#!/bin/bash while read Linedo echo $line
Done < file (files to be read)----------------------------------------------------------------------------Two:----------------------------------------- -----------------------------------#!/bin/bash
Cat file (file to be read) | While read lineDo echo $line Done----------------------------------------------------------------------------three-------------------------------------- --------------------------------------
for line in ' cat file (files to be read) '#读取的文件分行的, take a space as a line break do echo $line Done---------------------------------------------------------------------------References: http://blog.sina.com.cn/s/ Blog_67b7d7e40101b723.html
Shell reads file contents