diff --git a/Examples.md b/Examples.md index c0505b7..e311fb8 100644 --- a/Examples.md +++ b/Examples.md @@ -142,31 +142,20 @@ builtin bind '"\C-r": "\C-x1\e^\er"' # Toggle bash options (set and shopt) BOLD=$(tput bold || tput md) -#RESET=$(tput sgr0 || tput me) +RESET=$(tput sgr0 || tput me) GREEN=$(tput setaf 2 || tput AF 2) -RED=$(tput setaf 1) +RED=$(tput setaf 1 || tput AF 1) #WHITE=$(tput setaf 7 || tput AF 7) while read -r b o n _ do - case $b in - shopt) - if [[ $o == -u ]] - then - shopt -s "$n" - else - shopt -u "$n" - fi - ;; - set) - if [[ $o == \+o ]] - then - set -o "$n" - else - set +o "$n" - fi - ;; + case "${b}${o}" in + "set+o") set -o "$n" ;; + "set-o") set +o "$n" ;; + "shopt-s") shopt -u "$n" ;; + "shopt-u") shopt -s "$n" ;; esac + printf ${RESET} done < <( < <(shopt -p ; shopt -op) sed " / -[so] / {