how to get current terminal color pair in bash
问题 I would like to query and store the current terminal color pair in BASH e.g.: #!/bin/bash #some ANSI colour escape sequences red="\033[0;31m" grn="\033[0;32m" blu="\033[0;34m" def="\033[0;00m" # default echo -e "Change to ${red} red to ${def} default to ${blu} blue." # now store the current color (which happens to be blue) e.g.: cur=???? echo -e "Change to ${grn} green and back to what I had before ${cur}" echo -e "This would be in blue if variable cur contained e.g.: 0;34m." echo -e "Back to