Browse Source

Use read builtin safely

Alois Mahdal 7 years ago
parent
commit
257097e88c
1 changed files with 4 additions and 4 deletions
  1. 4
    4
      bin/notifirc

+ 4
- 4
bin/notifirc View File

@@ -15,7 +15,7 @@ mkcommands() {
15 15
     local message
16 16
     echo "NICK $nick"
17 17
     echo "USER $nick 8 * :notifirc bot"
18
-    while read message;
18
+    while read -r message;
19 19
     do
20 20
         echo "PRIVMSG $user :$message"
21 21
     done
@@ -45,7 +45,7 @@ warn() {
45 45
 
46 46
 log_pipe() {
47 47
     local line
48
-    while IFS= read line;
48
+    while IFS= read -r line;
49 49
     do
50 50
         log "$line"
51 51
     done
@@ -84,7 +84,7 @@ trim() {
84 84
     while true;
85 85
     do
86 86
         test $lines_read -ge $limit_l && break
87
-        IFS= read line || break
87
+        IFS= read -r line || break
88 88
         (( lines_read++ ))
89 89
         test ${#line} -gt $limit_c && suff=…
90 90
         line=${line:0:$limit_c}$suff
@@ -99,7 +99,7 @@ choose_logfile() {
99 99
         echo "$HOME/.notifirc.log"
100 100
         echo /tmp/notifirc.log
101 101
     } \
102
-      | while read path;
102
+      | while read -r path;
103 103
         do
104 104
             if test -w "$(dirname "$path")" \
105 105
              || test -w "$path";