Below is my script that is function properly per my conditions but I am facing one problem here that is when one function fails then Iy should not check other functions but it calls the other function too So anyone can help me how could i achieve this?
iNOUT i AM GIVING TO THE SCRIPT=D1234,S12345 | ROHIT SINGH
echo -en "Enter the logmsg="
read logmsg
logmsg1=${logmsg%%|*};
echo $logmsg1 |sed "s/$/,/g"|sed 's/[ \t]*$//'>pre-commit.config
logmsg_len2=$(echo ${logmsg} | awk '{print $2}');
logmsg_suffix="|";
length()
{
cat "pre-commit.config"| awk -F'[,|]' '{for(i=1;i<NF;i++) { if ( length($i) <= 6 ) { print " success"} else { print " error";exit 1;}}}';
}
Char()
{
#echo $logmsg1
echo $logmsg1 | tr ',' '\n' | awk '{if($0~/^D/||/^S/) {print $0" starts"} else {print " Please check your input(e.g. Start it with D or S)";exit;}}'
}
Pipe()
{
if [[ "${logmsg_len2}" != "${logmsg_suffix}" ]]; then
echo -e "error use | symbol"
exit 1;
else
echo "success"
fi
}
length
Char
Pipe