https://github.com/mathiasbynens/dotfiles dotfiles를 분기하고 "최신 버전을 가져 와서 파일을 홈 폴더로 복사"해야하는 bootstrap.sh를 실행하려고했습니다. .md쉘 스크립트 오류 : bootstrap.sh:13 : = 찾을 수 없음
그러나 bootstrap.sh를 소스하려고하면 오류가 반환됩니다. "bootstrap.sh:13 : = 찾을 수 없습니다". 라인 (13)은 사람이 그것을 잘못 생각이 있습니까
if [ "$1" == "--force" -o "$1" == "-f" ]; then doIt;
에서 doIt
부분입니까? 미리 감사드립니다.
#!/usr/bin/env bash
cd "$(dirname "${BASH_SOURCE}")";
git pull origin master;
function doIt() {
rsync --exclude ".git/" --exclude ".DS_Store" --exclude ".osx" \
--exclude "bootstrap.sh" --exclude "README.md" --exclude "LICENSE-MIT.txt" -avh --no-perms . ~;
source ~/.bash_profile;
}
if [ "$1" == "--force" -o "$1" == "-f" ]; then
doIt;
else
read -p "This may overwrite existing files in your home directory. Are you sure? (y/n) " -n 1;
echo "";
if [[ $REPLY =~ ^[Yy]$ ]]; then
doIt;
fi;
fi;
unset doIt;
어떻게 실행하나요? – melpomene
bashisms에 (구문, 의미 또는 가독성) 이점이 전혀없는 경우에도 POSIX sh 준수 사례를 사용하려는 노력을 분명히하지 않았습니다. 나는이 스크립트 사용에 대해 약간 회의적 인 경향이있다. –
... 실제로 문제의 일부입니다.이 스크립트는 bash 전용으로 작성되었으므로 사용중인 쉘은 bash가 아닙니다. –