我想知道是否有人可以帮助弄清楚为什么我的简单bash脚本无法正常工作,我不断得到:
svn:找不到命令
即使我安装了svn,它在我的脚本之外也能正常工作。
#!/bin/bash
## Get Directory Path From User
printf "\n";
printf "Uses of ~/ or . To Designate Directory Structure Will Not Work!\n"
printf "\n";
printf "Please Enter The FULL Path To The Directory\n"
printf "Where We Shall Create Copy of Slides\n"
read PATH
## If Path Is Valid
if [ -d "$PATH" ]; then
printf "Valid Path To Directory Entered\n"
## Attempt To Copy Files From SVN On Bluenose
`svn checkout https://svn.cs.dal.ca/csci2132/all/slides/ $Path`
printf "All Slides Have Been Copied To "
printf $PATH + "\n"
printf "\n"
## Invalid Path Entered Tell User And Exit
else
printf "Invalid Path Entered\n";
printf "Please Try Again\n";
exit 0;
fi
printf "Task Complete\n"
答案 0 :(得分:4)
shell查看PATH中以冒号分隔的目录列表以查找可执行文件。由于您已使用名称PATH作为目标目标,因此它正在寻找svn。只需为变量选择一个不同的名称。也就是说,不要覆盖PATH。