jitty-scripts/Gohunt.sh
2017-10-17 00:50:39 -07:00

48 lines
1.1 KiB
Bash

#!/bin/bash
# Colors
RED='\033[0;31m'
LRED="\033[1;31m"
BLUE="\033[0;34m"
LBLUE="\033[1;34m"
GREEN="\033[0;32m"
LGREEN="\033[1;32m"
YELLOW="\033[1;33m"
CYAN="\033[0;36m"
LCYAN="\033[1;36m"
PURPLE="\033[0;35m"
LPURPLE="\033[1;35m"
BWHITE="\e[1m"
NC='\033[0m' # No Color
##############################
createGopath(){
echo -e "\nYour GOPATH is not set, should we set it now?: "
read choice
if [ "${choice}" = "y" ] || [ "${choice}" = "Y" ];then
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc
if grep -Fx "${gPATH}" ~/.bashrc;then
echo -e "${LGREEN}\nGOPATH is set in bashrc\n${NC}"
else
echo -e "\nPlease set the GOPATH in .bashrc\n\n"
echo -e "\n'\nexport PATH=$PATH:/usr/local/go/bin'\n"
fi
else
echo "\n"
}
checkPath(){
gPATH='export PATH=$PATH:/usr/local/go/bin'
if grep -Fx "${gPATH}" ~/.bashrc;then
echo -e "${LGREEN}\nGOPATH is set in bashrc\n${NC}"
else
createGopath
}
checkDir(){
if [ ! -d ${GOPATH}]
}