简体   繁体   中英

How to echo variables in vertical order

I need help in this echo command. I want it to echo variables in vertical order but this didn't work for me

A=$(initctl status worker1)
B=$(initctl status worker2)
var="$(echo -e "\n$A \n$B")"

I would not put that echo inside of the var. Maybe this can help?

var="${A}\n${B}"
echo -e $var
A="$(initctl status worker1)"
B="$(initctl status worker2)"
var="$(echo -e "$A\n$B")"

then you can print the vertically formatted output, eg using:

echo "$var"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM