Bash – Read File – Examples

Bash Read File

Bash Read File – To read a file in Bash Scripting, you may use cat command or use “<” to open file and attach it to a standard input device handle of some application. In this Bash Tutorial, we shall present you with syntax and examples to read a file.

Example : Bash Read File using – cat fileName

Syntax

Sample File

Bash Script File

 

Example : Bash Read File using – $(<fileName)

Syntax

Bash Shell