Issue
I am not expert with bash but I would imagine this would be a simple script. I am trying to read a file with a few lines into a single bash variable without the new lines.
My current script reads them in but keeps the presence of newlines
options=$(<vm.options)
echo "$options"
The file looks something like this:
-Random 1
-Letters2
-Occur 3
-In
-Passwords9
The script would read this into a variable where its output would look like:
-Random 1 -Letters2 -Occur 3 -In -Passwords9
Solution
You can simply replace the new line with tr
:
options=$(cat lf | tr -s '\n' ' ')
Answered By - nullPointer Answer Checked By - Gilberto Lyons (WPSolving Admin)