Operaciones de comandos comunes de Shell

  1. Determine si la carpeta existe y luego realice la operación
# 准备pkg依赖,该命令可重复执行
if [ ! -d ${GOPATH}'/src/github.com/fwhezfwhez' ]; then
  mkdir -p ${GOPATH}/src/github.com/fwhezfwhez
fi
cd ${GOPATH}/src/github.com/fwhezfwhez
rm -rf pkg
git clone https://xxx.git pkg --depth 1;
  1. Cuando la variable de entorno no está configurada correctamente, detenga la ejecución e informe un error
if [ -z ${GOPATH} ]
then
echo "$GOPATH 是空字符串,终止执行"
exit
fi
echo "$GOPATH 不是是空字符串"

echo 'service2'

Supongo que te gusta

Origin blog.csdn.net/fwhezfwhez/article/details/104969210
Recomendado
Clasificación