在这里,我正在创建目录,如果该目录已经存在,则应该跳过该步骤,我尝试了一个,但是失败了。有人可以帮忙吗?
build_major=$(cat build.major)
build_minor=$(cat build.minor)
build_servicePack=$(cat build.servicePack)
build_patch=$(cat build.patch)
build_hotfix=$(cat build.hotfix)
build_number=$(cat build.number)
if[ -d "${build_major}.${build_minor}.${build_servicePack}.${build_patch}.${build_hotfix}_${build_number}" ];
then
cp file.txt /${build_major}.${build_minor}.${build_servicePack}.${build_patch}.${build_hotfix}_${build_number}
else
mkdir ${build_major}.${build_minor}.${build_servicePack}.${build_patch}.${build_hotfix}_${build_number}
cp file.txt /${build_major}.${build_minor}.${build_servicepack}.${build_patch}.${build_hotfix}_${build_number}
fi
但是失败的命令未找到错误
答案 0 :(得分:0)
现在假设相对路径:
if [ ! -d "./mydirname" ]
then
mkdir ./mydirname
fi