it's a while loop that goes as long as the value is null and repeats everything. When the value provided is 'quit', script goes into a subroutine where break is. Break makes the instant jump out of the loop
Code:
while [ -z "$name" ];do
echo "Please enter your forum name: "
read name
if [ "$name" == "quit" ];then # what if there name really is quit?
echo "Bye"
break;
elif [ -z "$name" ];then
clear
echo "If you don't have a name type 'quit' to exit, otherwise..."
fi
done
# break? jump here>
there is also continue that ends the current run of the loop and starts another one from the top
example showcasing it:
Code:
while [ -z "$name" ]; do
echo "from the top"
continue
echo "Please enter your forum name: "
read name
done
--------
from the top
from the top
from the top
...
that would be an infinite loop because continue would prevent the script from ever reaching read name part
Bookmarks