You can try this.. My own version of it..
funcc() {
while true ; do
for i in \| \/ \- \\ \| \/ \- \\; do
echo -n -e "\r$1 $i "
sleep 0.5
done
#echo -e "\r "
[ -f /tmp/print-stat ] && break 2
done
}
funcc "Checking Kubectl" & &>/dev/null
sleep 5
touch /tmp/print-stat
echo -e "\rPrint Success "