我需要跑步
评估“php /srv/www/scripts/mage/install-invoke-app.php”
它找到了文件,但最终得到
<?php
这在右边搞砸了。为什么?那是怎么固定的?到目前为止,谷歌搜索还没有得出正确的答案。
更新 简而言之,这是一个脚本,它是一个函数,然后我传递一个回调.. 有很多东西被剥离了,所以只有区域。
在包括 base.sh 脚本中
cd /srv/www/
. scripts/install-functions.sh
#tons of other stuff
cd /srv/www/
. scripts/mage-install.sh
在 install-functions.sh
install_repo(){
if [ $2 ]
then
echo "just 1"
git clone $1 -q
else
echo "just 1 and 2"
git clone $1 $2 -q
fi
success=$?
if [[ $success -eq 0 ]];
then
echo "Repository successfully cloned."
echo "cleaning"
cd $r/
rm -rf LICENSE.txt STATUS.txt README.md RELEASE_NOTES.txt modman
cd ../
cp -af $r/* .
rm -rf $r/
if [ -z "$3" ]
then
echo "no callback"
else
eval $3
fi
else
echo "Something went wrong!"
fi
sleep 1 # slow it down to insure that we have the items put in place.
}
#declare -A list = ( [repo]=gitUser )
install_repolist(){
gitRepos=$1
for r in "${!gitRepos[@]}" #loop with key as the var
do
giturl="git://github.com/${gitRepos[$r]}/$r.git"
echo "Adding $r From $giturl"
if [ -z "$r" ];
then
echo
else
install_repo $giturl $2 $3
fi
echo
done
return 1
}
在脚本/mage-install.sh
declare -A gitRepos
#[repo]=gitUser
gitRepos=(
[wsu_admin_base]=jeremyBass
[wsu_base_theme]=jeremyBass
[Storeutilities]=jeremyBass
[StructuredData]=jeremyBass
)
cd /srv/www/mage/
install_repolist $gitRepos 0 "php /srv/www/scripts/mage/install-invoke-app.php"
unset gitRepos #unset and re-declare to clear associative arrays
declare -A gitRepos
这就是这里的基本循环。我需要回调一个函数,但是 install_repolist 也用于其他领域,所以我无法对其进行硬编码。如果有更好的方法然后评估,酷