I am trying to get the output of some programs and assign them to variables. I am using backticks to do it, but I can switch to a different method if necessary. What I notice is that often I do not get the expected output in the variable. A simple case is this below. The actual examples I have are more complicated. Whatever the output from the program I'm running in the backticks I want it in the variable. Is that possible?
test=`echo [asdf]`
If I echo $test it shows just a.