I have this script that runs perfectly well, I would however like to re-run the script if the wrong input is entered, how could this be done?
#! /bin/bash
#! userInput - a script that reads in text and outputs it immediately
echo "Would you like to input some text? Y/N"
read request
if [[ $request = Y ]]; then
echo "Please input some text"
read input
echo $input
elif [[ $request = N ]]; then
echo "Thank You"
else
echo "Invalid Input - Please Input Y for yes or N for no"
fi
$request
in double quotes (even nices with curly braces like @Andy). When the request has a space, the if-statement will be invalid syntax (and you do not want*
replaced by a list of files). About the same is valid for$input
(better"${input}"
).