Hi,
I have a compiled c program that prints out a number. I want to write a bash script that collects that number into a variable (ok, it will be an array, in a loop, but that doesn't matter).
Code:
variable = $(myprog myarg)
was the way I thought it could do it. But doesn't work.
Of course I can redirect the output to a file and then read from the file, but that's messy. That's what bash redirections are for, really.
I also can modify my program to make it return the value rather than print it, but I was hoping to do this in bash.
My searching for this has not come up trumps yet.
Cheers for advice.