Skip to content

Commit b7bf7e1

Browse files
Fix lolcat determination in Rainbow echo, fix #5
Before this fix, only fish shell work 100% properly, this fix affected sh, bash, zsh and ksh.
1 parent 7ee9d63 commit b7bf7e1

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

generator.sh

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,17 @@ do
123123

124124
#rainbow output relys on lolcat
125125
fnName="${fn} echo${dot}Rainbow${brackets}"
126-
if [ "$shell" = "fish" ]; then
127-
ifCond="if type lolcat > /dev/null"
128-
else
129-
ifCond='if [ "type lolcat" ]; then'
130-
fi
126+
case "$shell" in
127+
"fish")
128+
ifCond="if type lolcat > /dev/null"
129+
;;
130+
"ksh")
131+
ifCond='if type lolcat 2> /dev/null >&2; then'
132+
;;
133+
*)
134+
ifCond='if type lolcat > /dev/null 2>&1; then'
135+
;;
136+
esac
131137

132138
cat << LOLCAT >> "$newDist"
133139
$fnName

0 commit comments

Comments
 (0)