在运行一个简单的脚本来为用户创建一个 repo 时出现这两个错误。
这是一个 bash 脚本
错误:
./createMyRepo.sh:第 48 行:寻找匹配的“”时出现意外 EOF
./createMyRepo.sh:第 52 行:语法错误:文件意外结束
#!/bin/bash
# This script is used to automate the repo
if [ -z `$1` ]
then
echo "No user was input, please input a user and try again"
exit
else
cd /home/$1
if [ $? -eq 0 ]
then
echo "Successfully changed directory to user's home"
else
echo "Failed to cd directory, trying to create directory now."
mkdir /home/$1
if [ $? -eq 0 ]
then
echo "Successfully created the directory location
else
echo "Failed to create directory, exiting."
exit
fi
fi
mkdir project.git
if [ $? -eq 0 ]
then
echo "Succesfully created project.git directory"
else
echo "Failed to create project.git directory attempting to see if the directory already exists"
cd project.git
if [ $? -eq 0 ]
then
echo "Successfully changed to this directory"
else
echo "This directory cannot be created and does not exist. exiting..."
exit
fi
fi
cd project.git
echo "creating git repo"
git --bare init
if [ $? -eq 0 ]
then
echo "DONE Created repo"
else
echo "FAIL repo did not create"
fi
fi