New answers tagged

0

fg_black="\e[30m" fg_white="\e[37m" bg_red="\e[41m" bg_blue="\e[44m" bg_purple="\e[45m" These control codes are terminal-specific. Prefer to use tput to create the appropriate codes for the actual $TERM being used.


0

Make a string str full of spaces with the length of variable a: printf -v str "%*s" ${#a} " " # or str="${a//[^ ]/ }*" I don't like the feature that you can have 2 different kind of parameters (string or function name) for setting a color. In the future you might want to enhance your function (make it split up the sting to a fg ...


9

Calling print is very slow, you should focus on building strings then have one print. Fortunately Python has some really nice string manipulation options. for col in range(upper_mid-1, row, -1): print(end=" ") You should rename col to _, which is standard nomenclature to say the variable is thrown away. Since the print isn't based on col ...


Top 50 recent answers are included