21/09/2019

[bash] Store content of file in a variable

In bash, it is possible to store the content of a file in a variable simply with:

file=/path/to/somefile.something
content="`cat $file`"

Note the special quotes used

No comments:

Post a Comment

With great power comes great responsibility