所以我recently asked about the unexpected token fi并修正了这些错误。现在我得到了不同的错误。有人可以通过我的脚本阅读并指出或修复你看到的所有错误 - 我是bash的新手而没有得到这些错误的一半。例如:
$ composerrun.sh
./composerrun.sh: line 2: checkForComposerJson: command not found
./composerrun.sh: line 27: syntax error near unexpected token `)'
./composerrun.sh: line 27: ` [Nn]*) '
当我跑步时:
#!/bin/bash
# We need to see if the AisisCore/ Directory exists.
# If it doesn't we will try and create it for you.
# Then to be safe - we check if it exists.
function checkForAisisCore {
if [[-d "AisisCore/"]]
then
return 0;
else
read -p "Would you like us to create the directory?" yn,
case $yn in
[[Yy]]*)
mkdir "AisisCore/";
if [[-d "AisisCore/"]]
then
return 0;
else
echo "We could not create the directory as you requested";
return 1;
end
;;
[[Nn]]*)
return 1;
;;
*)
echo "Please put in either yes or no";
esac
fi
}
# We check for the aisis-core inside of vender inside of adam.balan.
# If it exists return true.
# If Not, then alert the user and return false.
function checkForVendor(){
if [[-d "vender/adam.balan/aisis-core/"]]
then
return 0;
else
echo "Something is wrong. We could not find the vendor/ folder. Please check that you are running this script inside of your theme or project folder.";
return 1;
fi
}
# We need to know if composer.json exists.
# If it does we return true.
# If not - we alert the user.
function checkForComposerJson(){
if [[-f "composer.json"]]
then
return 0;
else
echo "You need composer.json with appropriate information about AisisCore";
return 1;
fi
}
# ================================ [ Core ] ================================
# Core program.
#
# Check if the composer.json and AisisCore/ exist.
# Run composer install.
# Check for vendor folder.
# If all is good - echo Found Vendor and exit. (For now).
if checkForComposerJson && checkForAisisCore
then
composer install
if checkForVendor
then
echo "Found vendor"; exit;
fi
fi
我确信有数百个错误和问题,但我看不到它们,因为我不知道bash。我想我现在正走在正确的轨道上。我怎么能在这个剧本上使用第二组眼睛就像“你在做什么......”