#!/bin/bash
#
set -e
if [ -z "`rpm -qa |grep mutt`" ];then
        sudo apt install mutt
fi
echo "install mutt over"
muttrc=~/.muttrc
if [ -e ${muttrc} ];then
        echo ".muttrc file over"
else
        echo "set use_from=yes" >> ${muttrc}
        echo "set realname=\"LSj_centos\"" >> ${muttrc}
        echo "set editor=\"nano\"" >> ${muttrc}
fi

chmod 755 ${muttrc}
if [ -z "`grep 'alias mail=\"mutt -s\"' /etc/profile`" ];then
        sed -i '$a alias mail=\"mutt -s\"' /etc/profile
        source /etc/profile
	echo "source env1"
else
        source /etc/profile
	echo "source env2"
fi

