Read file content to a variable using bash script – Code Example

To read file content to a variable, we will provide you a bash script code. This code can handle binary data as well. It is an alternative to the cat command.