Browse Source

Use -r with every `read` (according to ShellCheck)

Alois Mahdal 3 years ago
parent
commit
53c22ff5f5
1 changed files with 4 additions and 4 deletions
  1. 4
    4
      99bottles.sh

+ 4
- 4
99bottles.sh View File

@@ -107,7 +107,7 @@ grammar() {
107 107
     #
108 108
     local oneBottle=false   # 'true' if this line affects the following line
109 109
     local line              # every line
110
-    while read line; do
110
+    while read -r line; do
111 111
         line="${line/one more bottles/one more bottle}"
112 112
         case "$line" in
113 113
             *"one of those bottles"*)   line="$(
@@ -136,7 +136,7 @@ capitalize() {
136 136
     # Fix capitalization of each line on stdin
137 137
     #
138 138
     local line      # every line
139
-    while read line; do
139
+    while read -r line; do
140 140
         echo -n "${line:0:1}" | tr '[:lower:]' '[:upper:]'
141 141
         echo "${line#?}"
142 142
     done
@@ -147,7 +147,7 @@ punctuate() {
147 147
     # Add punctuation to each line on stdin
148 148
     #
149 149
     local line      # every line
150
-    while read line; do
150
+    while read -r line; do
151 151
         case "${line}" in
152 152
             [Ii]f*)     echo "${line},";;
153 153
             '')         echo;;
@@ -180,7 +180,7 @@ poeticize() {
180 180
     local first     # first word of a line
181 181
     local rest      # remainder of a line
182 182
     local syl       # number of syllables in the first word
183
-    while read first rest; do
183
+    while read -r first rest; do
184 184
         case "$rest" in
185 185
             *beer*)
186 186
                 first=${first/zero/no}