I have a simple function that colors its input argument.
color_text_red()
{
echo -e "\033[0;91m$1\033[0m"
}
Now, I have 2 variables START_COUNT and STOP_COUNT that have some value.
START_COUNT="1"
STOP_COUNT="2"
I would like to construct the string [1, 2] where 1, 2 is colorized. So, I did this :
out_res="${START_COUNT}, ${STOP_COUNT}"
echo "[$(color_text_red $out_res)]"
Sadly, this outputs only [1,].
Why $STOP_COUNT is missing ?
color_text_red $out_res- because you are passing two arguments to the function.$out_res. How can we achieve this otherwise ?