What we are saying;
We keep doing everything between
while true
do
....
done
WHILST true is true. True will always be true, so this would loop forever. We are saying 'keep doing this until we get an answer we want'.
Whilst in this loop we read the stdin (keyboard) into the variable CONFIRM and then check to see if it matches any of these patterns:
y or Y or YES or yes or Yes
- if it does we 'break' out of the while/do and the script continues after the 'done' statement (which closes the while do).
If not we check to see if it matches any of the (default) patterns:
n or N or no or NO or No
- if it does we exit the program with the 'exit' command.
If nothing matches we go back to reading the the stdin (keyboard) as true is still (and will always be) true.
The y or Y or YES or yes or Yes and n or N or no or NO or No is just to cover the various bases that a user may type instead of y or n. Users are odd like that.
We've covered the block:
while true
do
....
done
Your other question is about the CASE or 'switch' statement, basically this checks a variable against a list of cases. Here there are two - but one is the default 'catch all' (hence no break;; terminating it). The closing of case is easc (it's almost case backward).
Truth is, I'm no whizz with bash scripting. I keep a copy of everything useful I do, and the FTP and Y/N are common for me.
Take a look at this - it has some more meat ;-)
http://www.linuxquestions.org/questi...script-637221/