Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

read file using shell script

#!/bin/bash
input="/path/to/txt/file"
while IFS= read -r line
do
  echo "$line"
done < "$input"
Comment

bash read file content

cat file | while read line
do
  echo "a line: $line"
done
Comment

bash read file

#if you want to display the contents of a file on the terminal, do:
$ cat filename.file
Comment

PREVIOUS NEXT
Code Example
Shell :: bash loop over files with extension 
Shell :: docker logs path 
Shell :: linux how to execute a file 
Shell :: sudo-get update 
Shell :: how to get specific lines of shell output 
Shell :: environment variable setup 
Shell :: permission denied 
Shell :: swagger editor locally 
Shell :: rebase github 
Shell :: git initialize 
Shell :: kubectl kubernetes port forward 
Shell :: create file from terminal using cat 
Shell :: increase swap size ubuntu 
Shell :: github swaggo 
Shell :: windows 10 open git bash here 
Shell :: git hub 
Shell :: ubuntu setting network address 
Shell :: open command in linux 
Shell :: bash do-while 
Shell :: touch linux 
Shell :: mongo shell change db 
Shell :: what is the use of cat command in linux 
Shell :: steps to assign mfa using aws cli 
Shell :: flutter run 
Shell :: add user linux 
Shell :: connect to wifi with wpa supplicant raspberry pi 
Shell :: connect to remote redis over tls 
Shell :: Correct Folder Permissions Ubuntu 18.04 Server 
Shell :: git commit -am "make it better" error 
Shell :: git add cloud repo 
ADD CONTENT
Topic
Content
Source link
Name
7+7 =