|
|
|
|
|
by chasil
794 days ago
|
|
In startup.sh, here are a few things to think about. Instead of setting RED/GREEN/BLUE, you could do this: N=$(printf \\033)
N="$N[" x=30
for a in Bl R G Y B M C W # Black Red Green Yellow Blue Magenta Cyan White
do eval $a='$N'"'"$(( x))"m'" \
b$a='$N'"'"$((60 + x))"m'" \
${a}bg='$N'"'"$((10 + x))"m'" \
b${a}bg='$N'"'"$((70 + x))"m'" # bX=bright Xbg=background bXbg=brgt bgnd
x=$(( x + 1 ))
done # https://en.wikipedia.org/wiki/ANSI_escape_code
Unless you have "set -e" this: if [ ! "$HOSTNAME" ]; then
HOSTNAME="$(hostname -s)"
fi
Is more succinctly expressed as this: [ -z "$HOSTNAME" ] && HOSTNAME="$(hostname -s)"
|
|
Btw, The color script is cool. This makes ANSI sensible.