retry.sh

Ask if a user wants to run a script again then run it, for instance in case error.

Votes

echo -e "\033[0;1m\nPlay again? (y/n)\e[0m"
read ANSWER
echo -e "\n"

if [[ $ANSWER == y || $ANSWER == Y || $ANSWER == yes || $ANSWER == Yes || $ANSWER == YES ]]
then
    $0 #Runs the script again
else
    exit
fi

Vote Here

You must earn at least 1 vote on your snippets to be allowed to vote

Terms Of Use

Privacy Policy

Featured snippets are MIT license

Gears & Masters

Advertise

DevOpsnipp.com © 2020

medium.png