SharkRF openSPOT API Script

I build this simple login script because i was tired of manual logging in every time.
I will continue building this script.

Script (sh):


password="openspot"
server="openspot.local"
token="Login first (1) !!"
showMenu(){
echo "---------------------------"
echo " "
echo " openSPOT menu"
echo " "
echo " Server: "$server
echo " Password:" $password
echo " Token:" $token
echo " "
echo "---------------------------"
echo "|[1] Login to openSPOT !! |"
echo "|[2] Check Authorisation |"
echo "|[3] Show Token Info |"
echo "|[4] openSPOT Info |"
echo "|[5] Networksettings |"
echo "|[6] Radio Status |"
echo "|[7] openSPOT Profiles |"
echo "|[8] Logout |"
echo "|[9] Reboot openSPOT |"
echo "|[0] Exit Menu |"
echo "---------------------------"
read -p "Please Select A Number: " mc
return $mc
}
while [[ "$m" != "0" ]] do
if [[ "$m" == "1" ]]; then
echo " "
echo "Get token from sharkRF Openspot"
tokenurl=`curl http://$server/gettok.cgi| sed 's/{"token":"//'|sed 's/"}//'`
token=${tokenurl}
digest=`echo -n ${tokenurl}${password} | shasum -a 256 | sed 's/-//'`
jwt=`curl -X POST --header "Content-Type: application/json" --data "{\"token\":\"$token\",\"digest\":\"$digest\"}" "http://$server/login.cgi" | sed 's/{"hostname":"openspot","jwt":"//'|sed 's/"}//'`
elif [[ "$m" == "2" ]]; then
echo "Checking authorisation"
curl -H "Authorization: Bearer $jwt" http://$server/checkauth.cgi | json_pp
elif [[ "$m" == "3" ]]; then
echo "Token: "$token
echo "Digest: "$digest
echo "JWT: "$jwt
elif [[ "$m" == "4" ]]; then
echo "Getting info"
curl -H "Authorization: Bearer $jwt" http://$server/info.cgi | json_pp
elif [[ "$m" == "5" ]]; then
curl -H "Authorization: Bearer $jwt" http://$server/netsettings.cgi | json_pp
elif [[ "$m" == "6" ]]; then
curl -H "Authorization: Bearer $jwt" http://$server/status.cgi | json_pp
elif [[ "$m" == "7" ]]; then
curl -H "Authorization: Bearer $jwt" http://$server/cpsettings.cgi | json_pp
elif [[ "$m" == "8" ]]; then
curl -H "Authorization: Bearer $jwt" http://$server/logout.cgi | json_pp
token="Login first (1) !!"
digest=""
jwt=""
elif [[ "$m" == "9" ]]; then
curl -H "Authorization: Bearer $jwt" http://$server/reboot.cgi | json_pp
token="Login first (1) !!"
fi
showMenu
m=$?
done
exit 0;

I build a profile switcher menu, check it out here