#!/bin/bash

 echo "Start to Delete BackendFunction Environment variables"


os_ver=$(sw_vers -productVersion)

if [ ${os_ver%%.*} -ge 11 ] ; then
echo "Select BackendFunction Path to zshrc"
 profile_file="$HOME/.zshrc"

else

 if [[ ! -s "$HOME/.bash_profile" && -s "$HOME/.profile" ]] ; then
echo "Select BackendFunction Path to profile"
  profile_file="$HOME/.profile"
else
echo "Select BackendFunction Path to bash_profile"
  profile_file="$HOME/.bash_profile"
fi

fi

 sed -i '' 's/# Setting PATH for BackendFunction//g' "${profile_file}"
sed -i '' '/export PATH="\/Library\/Application Support\/AFI\/BFunc\/Cli:${PATH}"/d' "${profile_file}"

 echo "Finished to Delete BackendFunction Environment variables"
