|
@@ -167,7 +167,7 @@ verse() {
|
167
|
167
|
echo "Go to the store and buy some more"
|
168
|
168
|
nb=ninety-nine
|
169
|
169
|
else
|
170
|
|
- echo "$BreakLine"
|
|
170
|
+ echo "$TransitionLine"
|
171
|
171
|
nb=$(pred "$nb")
|
172
|
172
|
fi
|
173
|
173
|
echo "$nb bottles of beer on the wall"
|
|
@@ -214,16 +214,18 @@ syllables() {
|
214
|
214
|
}
|
215
|
215
|
|
216
|
216
|
main() {
|
217
|
|
- local BreakLine # bottle-break (or not) line
|
218
|
|
- local standard_break_line # ^^ standard variant
|
219
|
|
- local wasteful_break_line # ^^ wasteful (bottle breaks) variant
|
220
|
|
- local nb # beginning number
|
221
|
|
- standard_break_line="Take one down and pass it around"
|
222
|
|
- wasteful_break_line="If one of those bottles should happen to fall"
|
223
|
|
- BreakLine=$(
|
224
|
|
- [ "$1" = --careless ] \
|
225
|
|
- && echo "$wasteful_break_line" \
|
226
|
|
- || echo "$standard_break_line"
|
|
217
|
+ local TransitionLine # transition line between verses
|
|
218
|
+ local nb # beginning number
|
|
219
|
+ local mode=standard # transition mode
|
|
220
|
+ while true; do case $1 in
|
|
221
|
+ --careless) mode=careless; shift ;;
|
|
222
|
+ *) break ;;
|
|
223
|
+ esac done
|
|
224
|
+ TransitionLine=$(
|
|
225
|
+ case $mode in
|
|
226
|
+ standard) echo "Take one down and pass it around" ;;
|
|
227
|
+ careless) echo "If one of those bottles should happen to fall" ;;
|
|
228
|
+ esac
|
227
|
229
|
)
|
228
|
230
|
nb=ninety-nine
|
229
|
231
|
while [ -n "$nb" ]; do
|