1
0
mirror of https://github.com/ceph/ceph synced 2024-12-25 12:54:16 +00:00
ceph/ceph-menv/mset.sh
Yehuda Sadeh 30bebc266c ceph-menv: mrun shell environment
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
2018-05-21 13:51:16 -07:00

22 lines
533 B
Bash
Executable File

get_color() {
s=$1
sum=1 # just so that 'c1' isn't green that doesn't contrast with the rest of my prompt
for i in `seq 1 ${#s}`; do
c=${s:$((i-1)):1};
o=`printf '%d' "'$c"`
sum=$((sum+$o))
done
echo $sum
}
if [ "$1" == "" ]; then
unset MRUN_CLUSTER
unset MRUN_PROMPT
else
export MRUN_CLUSTER=$1
export MRUN_PROMPT='['${MRUN_CLUSTER}'] '
col=$(get_color $1)
MRUN_PROMPT_COLOR=$((col%7+31))
fi