askInstall() { read -p "Do you wish to install $1 [Y/n]: " answer answer=${answer:-Y} if [[ "$answer" == [Yy] ]]; then cd "$1" || return 1 echo -n "Installing $1: " chmod a+x "$1" cp "$1" /usr/local/bin > /dev/null 2>&1 || { echo "Failure"; echo "Error copying file, try running install script as sudo"; exit 1; } echo "Success" cd .. || return 1 fi } updateTool() { if [[ -f /usr/local/bin/$1 ]]; then usedGithubInstallMethod="1" cd "$1" || return 1 echo -n "Installing $1: " chmod a+x "$1" cp "$1" /usr/local/bin > /dev/null 2>&1 || { echo "Failure"; echo "Error copying file, try running install script as sudo"; exit 1; } echo "Success" cd .. || return 1 fi }