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

read the file from shell

#!/bin/sh
value=`cat config.txt`
echo "$value"

#!/bin/bash
value=$(<config.txt)
echo "$value"
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 :: macos kill dns cache 
Shell :: sudo command not found 
Shell :: export zip git project bash 
Shell :: .desktop file 
Shell :: Please make sure, that MariaDB Connector/C is installed on your system. 
Shell :: how to install comtypes 
Shell :: get public ssh key 
Shell :: remove everything in folder linux 
Shell :: find cuda path 
Shell :: angular cli linux 
Shell :: docker remove all image 
Shell :: installing saas in react application 
Shell :: angular 
Shell :: ubuntu zip file 
Shell :: how to check if ip is up bash script 
Shell :: why i am not able to make a directory in htdocs folder in ubuntu 
Shell :: verify parameter one bash 
Shell :: conda install pyserial 
Shell :: install snapd ubuntu 
Shell :: bash: bin/activate: No such file or directory 
Shell :: terminal find file by extension recursive 
Shell :: remove port binding windows 
Shell :: get saved wifi password windows 10 
Shell :: install getkirby 
Shell :: tmux how to scroll in history 
Shell :: change permissions pem 
Shell :: git reset to a file 
Shell :: wc in powershell 
Shell :: windows-build-tools 
Shell :: tail colorful 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =