On 09/07/2024 06:51 PM, Greg Wooledge wrote:
On Sat, Sep 07, 2024 at 22:00:27 +0000, Quaeryth wrote:
A query like "site:stackoverflow.com bash how to read file into variable" via
Google or DuckDuckGo (and maybe other search engines) usually points me in
the right direction. Good luck with your experiments!

What kind of file?
What kind of variable?
What are you planning to do with the variable after you've stored data
in it?

[snip]

I'll quote myself:

This started with exploring "regular expressions".
I discovered some tutorials that were using Bash in their samples.
One {lost the reference at the moment} was almost a match for a real
world problem I have. >
But I've not used Bash in eons and have forgotten how to read a file
into a single variable or a array variable.

I have 2 relevant test cases:
  1. a file of a single line approximately 200 characters.
     [teststring1.txt]
  2. a file with ~20 lines whose size is 4.5k.
     [teststring1.txt]

How?



Reply via email to