赞
踩
#!/bin/bash color() { green='\e[1;32m' res='\e[0m' yellow='\e[1;33m' echo -e ${green} clear } hello() { echo 1.debian/kali echo 2.centos echo 3.android echo 4.退出 read -p "配置Golang环境到什么系统:" i echo -e ${res} } change() { if [ $i -eq 1 ];then apt-get install wget -y url=https://dl.google.com/go/go1.12.17.linux-amd64.tar.gz wget $url tar -C /usr/local -xzf go1.12.17.linux-amd64.tar.gz elif [ $i -eq 2 ];then yum install wget -y url=https://dl.google.com/go/go1.12.17.linux-amd64.tar.gz wget $url tar -C /usr/local -xzf go1.12.17.linux-amd64.tar.gz elif [ $i -eq 3 ];then apt-get install wget -y url=https://dl.google.com/go/go1.13.8.linux-arm64.tar.gz wget $url tar -C /usr/local -xzf go1.13.8.linux-arm64.tar.gz elif [ $i -eq 4 ];then exit 1 else exit 1 fi } main() { color GOROOT=/usr/local/go/bin GOPATH=/root/go GOBIN=/root/go/bin command=`cat .profile | grep $GOROOT` if [ -n "$command" ]; then echo -e ${yellow} echo "Noting to do" echo -e ${res} exit 1 else hello change mkdir $HOME/go $HOME/go/src echo "export GOROOT=${GOROOT}" >> $HOME/.profile echo "export GOPATH=${GOPATH}" >> $HOME/.profile echo "export GOBIN=${GOBIN}" >> $HOME/.profile echo "export PATH=\$PATH:${GOROOT}" >> $HOME/.profile . $HOME/.profile echo -e ${green} echo "OK" echo -e ${res} fi } main
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。