As you can see the input in the first column (foo) will be split into separate columns based on the shell command that was used.
However, if you don’t want the last column to be the output of the shell command but the target variable, you can specify a suffix, such as the -t option. In this case, instead of doing:
bar=$(echo $foo | tr -cd “[:upper:]”)
you would do:
bar=$(echo $foo | tr -cd “[:upper:]”) -t
which will effectively pass the string Hello World as the value of the variable bar.
If you are building a large list of variables and can build a loop that does the echo for each variable, you can make it much quicker. For example, say you have 1000 columns and you wanted to do a small variation of each. You could do the following:
for (( i=0; i