我想知道是否有人可以帮助弄清楚为什么我的简单 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"
最佳答案
shell 查找 PATH 中以冒号分隔的目录列表以查找可执行文件。由于您已使用名称 PATH 作为目标目的地,因此它正在寻找 svn。只需为变量选择一个不同的名称。也就是说,不要覆盖 PATH。
关于linux - 为什么我得到 "svn: command not found",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33336496/