未验证 提交 260144e2 编写于 作者: C Chris Tan 提交者: GitHub

Fix spectrum.sh

Since spectrum.sh was copied from zsh, the typeset -A used is zsh specific and in bash4, it is declare -A. I've fixed it and I've added a check to error out with a readable message, in red color, to tell the user to upgrade bash.
上级 6f854593
......@@ -3,7 +3,20 @@
# P.C. Shyamshankar <sykora@lucentbeing.com>
# Copied from http://github.com/sykora/etc/blob/master/zsh/functions/spectrum/
typeset -Ag FX FG BG
# typeset in bash does not have associative arrays, declare does in bash 4.0+
# https://stackoverflow.com/a/6047948
_RED='\033[0;31m' # Red Color (For error)
_NC='\033[0m' # No Color (To reset the terminal color)
if [ "${BASH_VERSINFO[0]}" -lt 4 ]; then
echo -e "${_RED}ERROR${_NC}: Sorry, you need at least bash-4.0 to run this script." >&2;
exit 1;
fi
declare -Ag FX FG BG
FX=(
[reset]="%{^[[00m%}"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册