in several of a million ways…
simplest is probably
my_var=$(cat my_file)
If you use bash and you want to get spiffy you can use bash4’s mapfile, which puts an entire file into an array variable, one line per cell
mapfile my_var < my_file
in several of a million ways…
simplest is probably
my_var=$(cat my_file)
If you use bash and you want to get spiffy you can use bash4’s mapfile, which puts an entire file into an array variable, one line per cell
mapfile my_var < my_file