[PATCH v2 4/8] Use read -r in shell scripts

Rene Kita <[email protected]>
Newsgroups gmane.mail.mutt.devel
Message-ID <[email protected]>
Shellcheck warns:
read without -r will mangle backslashes.

While it is unlikely to happen in our case, just guard against the rare
case and avoid dealing with a warning. See [0] and [1] for a thorough
rational.

[0]: https://www.shellcheck.net/wiki/SC2162
[1]: https://mywiki.wooledge.org/BashFAQ/001
---
 contrib/bgedit-screen-tmux.sh | 3 +--
 patchlist.sh                  | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/contrib/bgedit-screen-tmux.sh b/contrib/bgedit-screen-tmux.sh
index 2adeebc3..9ab71157 100644
--- a/contrib/bgedit-screen-tmux.sh
+++ b/contrib/bgedit-screen-tmux.sh
@@ -61,6 +61,5 @@ else
   exit 1
 fi
 
-read exitval <"$tmpdir/status"
+read -r exitval <"$tmpdir/status"
 exit "$exitval"
-
diff --git a/patchlist.sh b/patchlist.sh
index ded488b2..6e17f797 100755
--- a/patchlist.sh
+++ b/patchlist.sh
@@ -35,7 +35,7 @@ void mutt_print_patchlist (void)
 {
 EOF
 
-list_patches | while read patch ; do
+list_patches | while read -r patch ; do
         echo "  puts (\"${patch}\");"
 done
 
-- 
2.51.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.