Merge pull request #547 from keymon/bugfix/546_infite_loop_ps4_with_command

Fix #546: infinite loop when $PS4 calls external command
pull/548/head
Nils Winkler 2015-08-12 15:57:42 +02:00
commit c00e22d6bf
1 changed files with 15 additions and 15 deletions

View File

@ -5,54 +5,54 @@ function __ {
} }
function __make_ansi { function __make_ansi {
next=$1 && shift next=$1; shift
echo "\[\e[$(__$next $@)m\]" echo "\[\e[$(__$next $@)m\]"
} }
function __make_echo { function __make_echo {
next=$1 && shift next=$1; shift
echo "\033[$(__$next $@)m" echo "\033[$(__$next $@)m"
} }
function __reset { function __reset {
next=$1 && shift next=$1; shift
out="$(__$next $@)" out="$(__$next $@)"
echo "0${out:+;${out}}" echo "0${out:+;${out}}"
} }
function __bold { function __bold {
next=$1 && shift next=$1; shift
out="$(__$next $@)" out="$(__$next $@)"
echo "${out:+${out};}1" echo "${out:+${out};}1"
} }
function __faint { function __faint {
next=$1 && shift next=$1; shift
out="$(__$next $@)" out="$(__$next $@)"
echo "${out:+${out};}2" echo "${out:+${out};}2"
} }
function __italic { function __italic {
next=$1 && shift next=$1; shift
out="$(__$next $@)" out="$(__$next $@)"
echo "${out:+${out};}3" echo "${out:+${out};}3"
} }
function __underline { function __underline {
next=$1 && shift next=$1; shift
out="$(__$next $@)" out="$(__$next $@)"
echo "${out:+${out};}4" echo "${out:+${out};}4"
} }
function __negative { function __negative {
next=$1 && shift next=$1; shift
out="$(__$next $@)" out="$(__$next $@)"
echo "${out:+${out};}7" echo "${out:+${out};}7"
} }
function __crossed { function __crossed {
next=$1 && shift next=$1; shift
out="$(__$next $@)" out="$(__$next $@)"
echo "${out:+${out};}8" echo "${out:+${out};}8"
} }
@ -114,18 +114,18 @@ function __color_rgb {
} }
function __color { function __color {
color=$1 && shift color=$1; shift
case "$1" in case "$1" in
fg|bg) side="$1" && shift ;; fg|bg) side="$1"; shift ;;
*) side=fg;; *) side=fg;;
esac esac
case "$1" in case "$1" in
normal|bright) mode="$1" && shift;; normal|bright) mode="$1"; shift;;
*) mode=normal;; *) mode=normal;;
esac esac
[[ $color == "rgb" ]] && rgb="$1 $2 $3" && shift 3 [[ $color == "rgb" ]] && rgb="$1 $2 $3"; shift 3
next=$1 && shift next=$1; shift
out="$(__$next $@)" out="$(__$next $@)"
echo "$(__color_${mode}_${side} $(__color_${color} $rgb))${out:+;${out}}" echo "$(__color_${mode}_${side} $(__color_${color} $rgb))${out:+;${out}}"
} }
@ -169,7 +169,7 @@ function __rgb {
function __color_parse { function __color_parse {
next=$1 && shift next=$1; shift
echo "$(__$next $@)" echo "$(__$next $@)"
} }