Replace tr with parameter expansion.

This commit is contained in:
Ceda EI 2019-09-06 22:24:35 +05:30
parent 886ec3bfaf
commit 4bed328fa2
5 changed files with 11 additions and 14 deletions

View File

@ -6,8 +6,8 @@ local fg_gradient=(16 16 16 16 16 15 15)
local j=0
for i in ${WISH_PLUGINS[@]}; do
[[ $i == "newline" ]] && j=0 && continue
eval WISH_$(echo $i | tr '[:lower:]' '[:upper:]')_BG=${gradient[$j]}
eval WISH_$(echo $i | tr '[:lower:]' '[:upper:]')_FG=${fg_gradient[$j]}
eval WISH_${i^^}_BG=${gradient[$j]}
eval WISH_${i^^}_FG=${fg_gradient[$j]}
((j++))
if [[ $j -eq ${#gradient[@]} ]]; then
j=0

View File

@ -6,8 +6,8 @@ local gradient=(e7c547 c0e551 82e35a 62e177 6bdfb3 73d4dd 7aa6da)
local j=0
for i in ${WISH_PLUGINS[@]}; do
[[ $i == "newline" ]] && j=0 && continue
eval WISH_$(echo $i | tr '[:lower:]' '[:upper:]')_BG=-1
eval WISH_$(echo $i | tr '[:lower:]' '[:upper:]')_FG=${gradient[$j]}
eval WISH_${i^^}_BG=-1
eval WISH_${i^^}_FG=${gradient[$j]}
((j++))
if [[ $j -eq ${#gradient[@]} ]]; then
j=0

View File

@ -2,6 +2,6 @@ WISH_DEFAULT_BG=-1
WISH_DEFAULT_FG=-1
WISH_POWERLINE=0
for i in ${WISH_PLUGINS[@]}; do
eval WISH_$(echo $i | tr '[:lower:]' '[:upper:]')_BG=-1
eval WISH_$(echo $i | tr '[:lower:]' '[:upper:]')_FG=-1
eval WISH_${i^^}_BG=-1
eval WISH_${i^^}_FG=-1
done

View File

@ -6,8 +6,8 @@ local fg_gradient=(000000 000000 000000 000000 000000 ffffff ffffff)
local j=0
for i in ${WISH_PLUGINS[@]}; do
[[ $i == "newline" ]] && j=0 && continue
eval WISH_$(echo $i | tr '[:lower:]' '[:upper:]')_BG=${gradient[$j]}
eval WISH_$(echo $i | tr '[:lower:]' '[:upper:]')_FG=${fg_gradient[$j]}
eval WISH_${i^^}_BG=${gradient[$j]}
eval WISH_${i^^}_FG=${fg_gradient[$j]}
((j++))
if [[ $j -eq ${#gradient[@]} ]]; then
j=0

View File

@ -101,16 +101,13 @@ function wish_main() {
if wish_${WISH_PLUGINS[$(($i + 1))]}_start $prev; then
local plugin=${WISH_PLUGINS[$i]}
local next_plugin=${WISH_PLUGINS[$(($i+1))]}
local fg_name=$(echo WISH_$(echo $plugin |
tr '[:lower:]' '[:upper:]')_BG)
local bg_name=$(echo WISH_$(echo $next_plugin |
tr '[:lower:]' '[:upper:]')_BG)
local fg_name="WISH_${plugin^^}_BG"
local bg_name="WISH_${next_plugin^^}_BG"
wish_append ${!bg_name} ${!fg_name}
fi
else
local plugin=${WISH_PLUGINS[$i]}
local fg_name=$(echo WISH_$(echo $plugin |
tr '[:lower:]' '[:upper:]')_BG)
local fg_name="WISH_${plugin^^}_BG"
wish_append -1 ${!fg_name}
fi
fi