Learning-Ocean
  • Ansible
  • Docker
  • Kubernetes
  • Docker-Compose
  • Docker-Swarm
  • Terraform
  • Shell Script
  • Subscribe
  • About Us
Shell Script
  • shell script tutorial
  • first shell script file
  • shebang
  • shell built-in and commands
  • print
  • comments and escape
  • user define variables
  • system variable
  • input
  • command line arguments
  • assign a command's output
  • read only variable
  • convert a string
  • substring
  • set default value
  • arithmetic operations
  • functions
  • parameters to a function
  • local variable
  • return status and test
  • if with command
  • if with numbers
  • if with string
  • if with files
  • not operator
  • and operator
  • or operator
  • if-else
  • nested if else
  • elif
  • case
  • while loop
  • read file
  • until
  • for loop
  • [email protected] and $*
  • select
  • continue
  • break
  • nested loop
  • project files

Read File in ShellScript


we can read a file with the help of read and while.


 The return code of read command is zero, unless the end-of-file is encountered.


#!/bin/bash
file_path="/etc/passwd"
while read line
do
    echo "$line"
    sleep 0.20
done < $file_path





PreviousNext