So i recently asked about the unexpected token fi and fixed those errors. Now I am getting different errors. can some one please read through my script and point out or fix all the errors you see -I am new to bash and not getting half of these errors. For example:
$ composerrun.sh
./composerrun.sh: line 2: checkForComposerJson: command not found
./composerrun.sh: line 27: syntax error near unexpected token `)'
./composerrun.sh: line 27: ` [Nn]*) '
When I run:
#!/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
I'm sure there's hundreds of errors and issues but I cant see them because I don't know bash. I think I am on the right track though. How ever I could use a second set of eyes on this script to be like "what are you doing ... "