Browse Source

Move main execution to main()

Alois Mahdal 3 years ago
parent
commit
e1193e9102
1 changed files with 16 additions and 13 deletions
  1. 16
    13
      99bottles.sh

+ 16
- 13
99bottles.sh View File

@@ -195,17 +195,20 @@ syllables() {
195 195
     echo $n
196 196
 }
197 197
 
198
+main() {
199
+    standardBreakLine="Take one down and pass it around"
200
+    wastefulBreakLine="If one of those bottles should happen to fall"
201
+    breakLine=$([ "$1" = --careless ] \
202
+     && echo $wastefulBreakLine \
203
+     || echo $standardBreakLine)
204
+
205
+    nb=ninety-nine
206
+
207
+    while [ -n "$nb" ]; do
208
+        verse $nb
209
+        echo
210
+        nb=$(pred $nb)
211
+    done | poeticize | grammar | punctuate | capitalize
212
+}
198 213
 
199
-standardBreakLine="Take one down and pass it around"
200
-wastefulBreakLine="If one of those bottles should happen to fall"
201
-breakLine=$([ "$1" = --careless ] \
202
- && echo $wastefulBreakLine \
203
- || echo $standardBreakLine)
204
-
205
-nb=ninety-nine
206
-
207
-while [ -n "$nb" ]; do
208
-    verse $nb
209
-    echo
210
-    nb=$(pred $nb)
211
-done | poeticize | grammar | punctuate | capitalize
214
+main "$@"