From 9cd26a24959ac339f44b6cde6195116a9f1e6656 Mon Sep 17 00:00:00 2001
From: f380cedric <f380cedric@users.noreply.github.com>
Date: Mon, 5 Oct 2020 11:30:58 +0200
Subject: Use POSIX-compliant read

Rewrite #520.
Using `read var?'prompt'` is wrong. It is ksh (and zsh) specific.
Using `read -p 'prompt' var` is also wrong. It is bash specific.
Since we cannot assume which sh is implemented,
we should write POSIX-compliant code.
---
 share/mutt-wizard.muttrc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/share/mutt-wizard.muttrc b/share/mutt-wizard.muttrc
index c3dae24..57df579 100644
--- a/share/mutt-wizard.muttrc
+++ b/share/mutt-wizard.muttrc
@@ -71,7 +71,7 @@ bind editor <Tab> complete-query
 macro index,pager a "<enter-command>set my_pipe_decode=\$pipe_decode pipe_decode<return><pipe-message>abook --add-email<return><enter-command>set pipe_decode=\$my_pipe_decode; unset my_pipe_decode<return>" "add the sender address to abook"
 macro index \Cr "T~U<enter><tag-prefix><clear-flag>N<untag-pattern>.<enter>" "mark all messages as read"
 macro index O "<shell-escape>mbsync -a<enter>" "run mbsync to sync all mail"
-macro index \Cf "<enter-command>unset wait_key<enter><shell-escape>read x?'Enter a search term to find with notmuch: '; echo \$x >~/.cache/mutt_terms<enter><limit>~i \"\`notmuch search --output=messages \$(cat ~/.cache/mutt_terms) | head -n 600 | perl -le '@a=<>;s/\^id:// for@a;$,=\"|\";print@a' | perl -le '@a=<>; chomp@a; s/\\+/\\\\+/ for@a;print@a' \`\"<enter>" "show only messages matching a notmuch pattern"
+macro index \Cf "<enter-command>unset wait_key<enter><shell-escape>printf 'Enter a search term to find with notmuch: '; read x; echo \$x >~/.cache/mutt_terms<enter><limit>~i \"\`notmuch search --output=messages \$(cat ~/.cache/mutt_terms) | head -n 600 | perl -le '@a=<>;s/\^id:// for@a;$,=\"|\";print@a' | perl -le '@a=<>; chomp@a; s/\\+/\\\\+/ for@a;print@a' \`\"<enter>" "show only messages matching a notmuch pattern"
 macro index A "<limit>all\n" "show all messages (undo limit)"
 
 # Sidebar mappings
-- 
cgit v1.2.3