#!/bin/bash
JAVA_VERSION=`java -version 2>&1 |awk 'NR==1{ gsub(/"/,""); print $3 }'`
echo java version is $JAVA_VERSION
GIT_VERSION=`git --version 2>&1 |awk 'NR==1{gsub(/"/,"");print $3}'`
if [ $GIT_VERSION == "未找到命令" ];then
echo 'git not find'
if [ ! -d /home/oriente/bestfei/git/ ];then
echo 'no path:/home/oriente/bestfei/git/,mkdir path'
mkdir -p /home/oriente/bestfei/git
else
echo 'has git path,begin to download git '
rm -rf /home/oriente/bestfei/git && mkdir -p /home/oriente/bestfei/git
cd /home/oriente/bestfei/git && wget https://www.kernel.org/pub/software/scm/git/git-2.9.0.tar.gz
tar -zxf git-2.9.0.tar.gz
cd git-2.9.0
GIT_PATH=$(pwd)
echo git path is $GIT_PATH
fi
else
echo git version is $GIT_VERSION
fi
shell 脚本部署git
最新推荐文章于 2023-03-13 09:34:48 发布