upgrade_or_install() { git fetch --tags latestTag=$(git describe --tags `git rev-list --tags --max-count=1`) git checkout $latestTag echo '>> src/configure && make -C src' src/configure && make -C src if ! [ $? -eq 0 ]; then echo Previous command failed read 'Quit? [Y/n] ' if ! [ "$REPLY" -eq n ]; then exit 1 fi echo Wow, really? ok then fi }