Как вернуть список писем по дате с помощью mutt?

Снимок экрана в вопросе выглядит как whiptail (функционально сокращенная программа, имитирующая dialog , с использованием newt вместо ncurses ). Способ отображения заголовка и кнопок встроен в каждую программу, поэтому они выглядят по-разному.

Вот сценарий, который дублирует исходный снимок экрана, либо для хлыста, либо для диалога:

#!/bin/sh
: ${DIALOG:=dialog}
case "$DIALOG" in
*dialog*)
        OPTS="$OPTS --cr-wrap"
        high=10
        ;;
*whiptail*)
        high=12
        ;;
esac
rows=$(stty size | cut -d' ' -f1)
[ -z "$rows" ] && rows=$high
[ $rows -gt $high ] && rows=$high
cols=$(stty size | cut -d' ' -f2)
$DIALOG --backtitle "Package configuration" \
       --title "Configuring sun-java6-jre" \
       $OPTS \
       --yesno '\nIn order to install this package, you must accept the license terms, the "Operating System Distributor License for Java" (DLJ), v1.1. Not accepting will cancel the installation.\n\nDo you accept the DLJ license terms?' $rows $((cols - 5))

и для сравнения снимок экрана с хлыстом:

screenshot with whiptail

и с диалогом:

screenshot with dialog

Помимо разного внешнего вида заголовка и кнопок, По умолчанию диалоговое окно использует разные цвета (хотя это можно настроить - см. снимки экрана ) и использует меньше строк на экране.

диалоговое окно (и whiptail) используют библиотеки для управления отображением линий, цветов и т. Д. Но вы также можете увидеть тритон, используемый в программе Red Hat anaconda как разделяемую библиотеку, вызываемую из python (с тем же внешность).Аналогичным образом, программа конфигурации ядра началась как (урезанная) копия диалога, а затем превратилась в функции, использующие разделяемую библиотеку (без исходной программы lxdialog ), во многом аналогично тому, как используется newt. из питона.

Из bash - для наиболее часто используемых функций вы можете использовать диалог или whiptail. Кто-то написал для них оболочку (на perl) , чтобы сценарии могли более легко использовать те или иные, но вам лучше использовать диалог напрямую, поскольку модуль perl по сути является общим знаменателем.

Источники диалогов включают в себя примеры всех виджетов вместе с большинством параметров командной строки:

cdialog (ComeOn Dialog!) version 1.3-20160424
Copyright 2000-2015,2016 Thomas E. Dickey
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

* Display dialog boxes from shell scripts *

Usage: cdialog  { --and-widget  }
where options are "common" options, followed by "box" options

Special options:
  [--create-rc "file"]
Common options:
  [--ascii-lines] [--aspect ] [--backtitle ] [--beep]
  [--beep-after] [--begin  ] [--cancel-label ] [--clear]
  [--colors] [--column-separator ] [--cr-wrap] [--date-format ]
  [--default-button ] [--default-item ] [--defaultno]
  [--exit-label ] [--extra-button] [--extra-label ]
  [--help-button] [--help-label ] [--help-status] [--help-tags]
  [--hfile ] [--hline ] [--ignore] [--input-fd ]
  [--insecure] [--item-help] [--keep-tite] [--keep-window] [--last-key]
  [--max-input ] [--no-cancel] [--no-collapse] [--no-cr-wrap]
  [--no-items] [--no-kill] [--no-label ] [--no-lines] [--no-mouse]
  [--no-nl-expand] [--no-ok] [--no-shadow] [--no-tags] [--nook]
  [--ok-label ] [--output-fd ] [--output-separator ]
  [--print-maxsize] [--print-size] [--print-version] [--quoted]
  [--scrollbar] [--separate-output] [--separate-widget ] [--shadow]
  [--single-quoted] [--size-err] [--sleep ] [--stderr] [--stdout]
  [--tab-correct] [--tab-len ] [--time-format ] [--timeout ]
  [--title ] [--trace <file>] [--trim] [--version] [--visit-items]
  [--week-start <str>] [--yes-label <str>]
Box options:
  --buildlist    <text> <height> <width> <list-height> <tag1> <item1> <status1>...
  --calendar     <text> <height> <width> <day> <month> <year>
  --checklist    <text> <height> <width> <list height> <tag1> <item1> <status1>...
  --dselect      <directory> <height> <width>
  --editbox      <file> <height> <width>
  --form         <text> <height> <width> <form height> <label1> <l_y1> <l_x1> <item1> <i_y1> <i_x1> <flen1> <ilen1>...
  --fselect      <filepath> <height> <width>
  --gauge        <text> <height> <width> [<percent>]
  --infobox      <text> <height> <width>
  --inputbox     <text> <height> <width> [<init>]
  --inputmenu    <text> <height> <width> <menu height> <tag1> <item1>...
  --menu         <text> <height> <width> <menu height> <tag1> <item1>...
  --mixedform    <text> <height> <width> <form height> <label1> <l_y1> <l_x1> <item1> <i_y1> <i_x1> <flen1> <ilen1> <itype>...
  --mixedgauge   <text> <height> <width> <percent> <tag1> <item1>...
  --msgbox       <text> <height> <width>
  --passwordbox  <text> <height> <width> [<init>]
  --passwordform <text> <height> <width> <form height> <label1> <l_y1> <l_x1> <item1> <i_y1> <i_x1> <flen1> <ilen1>...
  --pause        <text> <height> <width> <seconds>
  --prgbox       <text> <command> <height> <width>
  --programbox   <text> <height> <width>
  --progressbox  <text> <height> <width>
  --radiolist    <text> <height> <width> <list height> <tag1> <item1> <status1>...
  --rangebox     <text> <height> <width> <min-value> <max-value> <default-value>
  --tailbox      <file> <height> <width>
  --tailboxbg    <file> <height> <width>
  --textbox      <file> <height> <width>
  --timebox      <text> <height> <width> <hour> <minute> <second>
  --treeview     <text> <height> <width> <list-height> <tag1> <item1> <status1> <depth1>...
  --yesno        <text> <height> <width>

Auto-size with height and width = 0. Maximize with height and width = -1.
Global-auto-size if also menu_height/list_height = 0.
</code></pre><p> Дополнительная литература: </p><ul><li><a href="https://unixconf.ru/go.php?url=http%3A%2F%2Finvisible-island.net%2Fdialog%2Fdialog.html" rel="nofollow noreferrer" target="_parent"> dialog </a></li>
<li><a href="https://unixconf.ru/go.php?url=http%3A%2F%2Finvisible-island.net%2Fncurses%2Fncurses.html" rel="nofollow noreferrer" target="_parent"> ncurses </a></li>
<li><a href="https://unixconf.ru/go.php?url=https%3A%2F%2Ffedoraproject.org%2Fwiki%2FAnaconda%2FFeatures%2FNoLoader" rel="nofollow noreferrer" target="_parent"> Anaconda / Features / NoLoader </a></li>
<li><a href="https://unixconf.ru/go.php?url=https%3A%2F%2Funix.stackexchange.com%2Fquestions%2F146556%2Fhow-to-create-guis-such-as-menuconfig-with-lxdialog" target="_parent"> Как сделать создавать графические интерфейсы (например, menuconfig) с помощью lxdialog </a></li>
</ul></p>
                    </div>
                    <div class="votes-question">
                        <div class="vote-count" itemprop="upvoteCount">1</div>
                        <i class="fa fa-thumbs-o-up"></i>
                    </div>
                    <div class="tags">
                        <a href="/tags/ubuntu" class="tag"  title="ubuntu" rel="tag">ubuntu</a> <a href="/tags/email" class="tag"  title="email" rel="tag">email</a> <a href="/tags/configuration" class="tag"  title="configuration" rel="tag">configuration</a> <a href="/tags/mutt" class="tag"  title="mutt" rel="tag">mutt</a>                    </div>
                    <div class="clearfix"></div>
                    <div class="action-time">
                        <span itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">k0pernikus</span></span>
                        <span itemprop="dateCreated" title="21.10.2015, 18:19 ">21.10.2015, 18:19 </span>
                    </div>

                    <a class="s-link" href="/questions/136413-kak-vernut-spisok-pisem-po-date-s-pomoschju-mutt" title="Ссылка" itemprop="url">Ссылка</a>
                </div>
            </div>
            <div class="pull-left"><span itemprop="answerCount">2</span> ответа</div>
        </div>
        <div style="height:100px;margin:10px 0px;" class="">
                    </div>
        <div class="answers" id="answers">

            <div class="clearfix"></div>

            <div class="answer-pager">
                <div class="pagination">
                                    </div>
            </div>

            
                <div class="answer" id="124258" itemscope itemtype="http://schema.org/Answer" itemprop="suggestedAnswer">
                    <div class="answer-row">
                        <div class="answer-text">
                            <div class="description" itemprop="text">
                                <p> Думаю, уместное предложение в вашем вопросе: </p>

<blockquote>
 <p> Я пытался добавить файл ~ / .muttrc ... </p>
</blockquote>

<p> Конфигурация вашего office365 mutt находится в <code> ~ / .mutt / muttrc </code>? </p>

<p> Ошибка (<em> / var / mail / philipp: Нет такого файла или каталога </em>) показывает, что параметр <code> spoolfile </code> по какой-то причине сброшен на значение по умолчанию - файл конфигурации, в котором он был изменен, больше не читается. </p>

<p> Думаю, <code> mutt </code> ищет свой файл конфигурации либо в <code> ~ / .muttrc </code> <strong>, либо в </strong> <code> ~ / .mutt / muttrc </code>, и когда он находит первый файл, он не буду оценивать второй. </p>

<p><strong> Решение 1 </strong></p>

<p> Поместите эти команды также в <code> ~ / .mutt / muttrc </code>. </p>

<p> Недостаток: если вы обновите конфигурацию office365 mutt, ваши параметры могут быть перезаписаны. </p>

<p><strong> Решение 2 </strong></p>

<p> Сообщите <code> ~ / .muttrc </code>, чтобы он также использовал другой файл конфигурации. </p>

<p> Просто вставьте </p>

<pre><code>source ~/.mutt/muttrc
</code></pre>

<p> в свой <code> ~ / .muttrc </code>, чтобы Mutt оценил этот файл как. <br /> 
Вставьте его перед своими собственными параметрами, поэтому, если в обоих файлах конфигурации определены какие-либо параметры, ваш будет последним, прочитанным Mutt. </p>                            </div>
                            <div class="votes-answer green">

                                <div class="vote-count" itemprop="upvoteCount">1</div>
                                <i class="fa fa-thumbs-o-up"></i>
                            </div>
                            <div class="clearfix"></div>
                            <div class="action-time">
                                <span itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name"></span></span>
                                <span itemprop="dateCreated" title="29.04.2021, 00:22 ">29.04.2021, 00:22 </span>
                            </div>
                            <a class="s-link" href="/136413-kak-vernut-spisok-pisem-po-date-s-pomoschju-mutt#584" title="Ссылка" itemprop="url">Ссылка</a>
                        </div>
                                                <div class="post-layout--right">
                            <div id="comments-124258">
                                <ul class="comments-list js-comments-list" data-remaining-comments-count="0" data-canpost="false" data-cansee="true" data-comments-unavailable="false" data-addlink-disabled="true">

                                                                    </ul>
                            </div>
                        </div>
                    </div>
                </div>

                                    <div class="answer">
                        <div class="answer-row">
                            <div class="answer-text">
                                <div class="description" itemprop="text">

                                                                    </div>
                            </div>
                        </div>
                    </div>
                    
                <div class="answer" id="291135" itemscope itemtype="http://schema.org/Answer" itemprop="suggestedAnswer">
                    <div class="answer-row">
                        <div class="answer-text">
                            <div class="description" itemprop="text">
                                <p>Изменить первую строку с </p><pre><code>set sort_aux=last-date-received 
</code></pre><p>- </p><pre><code>set sort_aux=reverse-last-date-received
</code></pre><p>Таким образом, все это должно выглядеть так:</p><pre><code>set sort_aux=reverse-last-date-received       
set sort=threads
set sort_re
</code></pre>                            </div>
                            <div class="votes-answer">

                                <div class="vote-count" itemprop="upvoteCount">0</div>
                                <i class="fa fa-thumbs-o-up"></i>
                            </div>
                            <div class="clearfix"></div>
                            <div class="action-time">
                                <span itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">Baljit Sarai</span></span>
                                <span itemprop="dateCreated" title="03.11.2021, 21:06 ">03.11.2021, 21:06 </span>
                            </div>
                            <a class="s-link" href="/136413-kak-vernut-spisok-pisem-po-date-s-pomoschju-mutt#584" title="Ссылка" itemprop="url">Ссылка</a>
                        </div>
                                                <div class="post-layout--right">
                            <div id="comments-291135">
                                <ul class="comments-list js-comments-list" data-remaining-comments-count="0" data-canpost="false" data-cansee="true" data-comments-unavailable="false" data-addlink-disabled="true">

                                                                    </ul>
                            </div>
                        </div>
                    </div>
                </div>

                                        <div style="margin-top: 20px;">
                <h3>Теги</h3>
                <div class="tags" style="display: inline-block; float: none;">
                    <a href="/tags/ubuntu" class="tag"  title="ubuntu" rel="tag">ubuntu</a> <a href="/tags/email" class="tag"  title="email" rel="tag">email</a> <a href="/tags/configuration" class="tag"  title="configuration" rel="tag">configuration</a> <a href="/tags/mutt" class="tag"  title="mutt" rel="tag">mutt</a>                </div>

                <h3 class="m-t-20">Похожие вопросы</h3>
                <div class="related-block">
                    <ul>
                                                    <li>
                                <div class='votes-answer ' title="Количество голосов за вопрос"><span class='vote-count' title="Количество голосов за вопрос">0</span> <i
                                            class="fa fa-thumbs-o-up"></i></div>
                                <a href="/questions/92157-podkljuchenie-obschego-diska-iz-windows-s-pomoschju-cifs" title=" Подключение общего диска из Windows с помощью CIFS "> Подключение общего диска из Windows с помощью CIFS </a> <span class="date">01.10.2015 </span>
                                <div class="votes-small-content"> Я пытаюсь смонтировать несколько общих дисков в моей сети (один Time Capsule, 3 общих диска из Windows 10) на Raspberry Pi 2 под управлением Ubuntu 14.04 с возможностью чтения и записи ... </div>
                            </li>

                                                        <li>
                                <div class='votes-answer green' title="Количество голосов за вопрос"><span class='vote-count' title="Количество голосов за вопрос">1</span> <i
                                            class="fa fa-thumbs-o-up"></i></div>
                                <a href="/questions/11831-linux-konfiguracija-vps" title="Linux конфигурация VPS">Linux конфигурация VPS</a> <span class="date">29.06.2012 </span>
                                <div class="votes-small-content">Я просто недавно достал Linux (Fedora) VPS, и я хотел бы спросить, существуют ли специальные конфигурации, которых я должен опасаться. Сделайте я все еще настраиваю его как, я настроил бы нормальное...</div>
                            </li>

                                                        <li>
                                <div class='votes-answer green' title="Количество голосов за вопрос"><span class='vote-count' title="Количество голосов за вопрос">4</span> <i
                                            class="fa fa-thumbs-o-up"></i></div>
                                <a href="/questions/21277-otpravka-elektronnogo-pisma-ip-adresu-cherez-postfiks" title="отправка электронного письма IP-адресу через постфикс">отправка электронного письма IP-адресу через постфикс</a> <span class="date">16.06.2014 </span>
                                <div class="votes-small-content">Мой друг и я настроили два Постфиксных почтовых сервера на наших ноутбуках. Мы преуспели в том, чтобы отправить почту в реальную сеть (в некоторые учетные записи Gmail) от наших компьютеров; это было легкой частью. Мы теперь...</div>
                            </li>

                                                        <li>
                                <div class='votes-answer green' title="Количество голосов за вопрос"><span class='vote-count' title="Количество голосов за вопрос">4</span> <i
                                            class="fa fa-thumbs-o-up"></i></div>
                                <a href="/questions/16102-ja-mogu-otobrazit-chast-okna-na-vtorom-ustrojstve" title="Я могу отобразить часть окна на втором устройстве?">Я могу отобразить часть окна на втором устройстве?</a> <span class="date">19.07.2013 </span>
                                <div class="votes-small-content">При предоставлении презентаций я использую html/css/js-based позерство. Это имеет режим предъявителя, который показывает примечания и прогресс хорошим способом ко мне. Кажется, что идея - это так или иначе секунда...</div>
                            </li>

                                                        <li>
                                <div class='votes-answer ' title="Количество голосов за вопрос"><span class='vote-count' title="Количество голосов за вопрос">1</span> <i
                                            class="fa fa-thumbs-o-up"></i></div>
                                <a href="/questions/122481-sshfs-oshibka-plohoj-shifr-ssh2-specifikacii-arcfour-i-chitat-perezagruzka-soedinenija-po-piringovoj-sheme" title=" SSHFS Ошибка: "Плохой шифр SSH2 спецификации 'arcfour'" и "читать": Перезагрузка соединения по пиринговой схеме""> SSHFS Ошибка: "Плохой шифр SSH2 спецификации 'arcfour'" и "читать": Перезагрузка соединения по пиринговой схеме"</a> <span class="date">19.10.2018 </span>
                                <div class="votes-small-content">Hellow world! Итак, я начал разработку проекта, который будет работать на rPi-3B+. Я столкнулся с проблемой с SSHFS. Сейчас мне бы очень хотелось иметь возможность редактировать и коммитировать git-репо, хранящееся в ... </div>
                            </li>

                                                        <li>
                                <div class='votes-answer ' title="Количество голосов за вопрос"><span class='vote-count' title="Количество голосов за вопрос">1</span> <i
                                            class="fa fa-thumbs-o-up"></i></div>
                                <a href="/questions/71061-problema-soedinjajuschajasja-s-beagleboard-cherez-serial" title="Проблема, соединяющаяся с Beagleboard через сериал?">Проблема, соединяющаяся с Beagleboard через сериал?</a> <span class="date">12.01.2015 </span>
                                <div class="votes-small-content">Я пытаюсь соединиться с BeagleBoard на Ubuntu с помощью СЕРИАЛА К USB-АДАПТЕРУ. Это в настоящее время распознается как ttyUSB0 в нашей системе. Когда я выполняю "экран/dev/ttyusb0 115200", вывод просто говорит "...</div>
                            </li>

                                                        <li>
                                <div class='votes-answer ' title="Количество голосов за вопрос"><span class='vote-count' title="Количество голосов за вопрос">1</span> <i
                                            class="fa fa-thumbs-o-up"></i></div>
                                <a href="/questions/78709-udalite-druguju-ustanovku-linux-na-tom-zhe-zhestkom-diske" title="Удалите другую установку Linux на том же жестком диске">Удалите другую установку Linux на том же жестком диске</a> <span class="date">26.06.2014 </span>
                                <div class="votes-small-content">У меня есть следующая установка: [phil@thinkpad ~] $ lsblk НАЗЫВАЕТ РАЗМЕР RM MAJ:MIN ТОЧКОЙ МОНТИРОВАНИЯ ТИПА RO sda 8:0 0 238,5G 0 дисковых частей  sda2 8:2 0 111,8G 0 части  sda1 8:1 0 52,3G 0/...</div>
                            </li>

                                                </ul>
                </div>
            </div>
        </div>

    </div>
</section>      </div>
      <aside class="sidebar">
        <div class="awrap">


          
        </div>
      </aside>

    </div>
  </div>
  <footer class="footer">
    <div class="wrapper wrapper--sm">
      <div class="footer-navs-col">
        <div class="footer-nav footer-nav--menu">

          <div class="footer-coryright">Вопросы и ответы Unix / Linux</div>
        </div>
        <div class="footer-nav footer-nav--catalog">
          <div class="footer-nav__title">Интересные проекты</div>
          <nav class="footer-menu">
<ul>
  <li class="footer-menu__item"><a class="footer-menu__link" href="https://askubuntu.ru">Вопросы о Ubuntu системах</a></li>
</ul>
          </nav>
        </div>
      </div>
      <div class="footer-contacts-col">
        <div class="soc-widget-col">
        </div>
      </div>
      <div class="clearfix"></div>
    </div>

  </footer>

</div>

<script type="text/javascript" src="/js/ui/jquery-ui-1.8.16.custom.min.js"  async></script>
<script type="text/javascript" src="/js/ui/external/jquery.cookie.js"  async></script>

<script type="text/javascript" src="/js/versions/menu.ru.u1528232400.js"  async></script>


<script type="text/javascript" src="/js/jquery.fancybox.min.js" async></script>
<script type="text/javascript" src="/js/slick.min.js"  async></script>
<script type="text/javascript" src="/js/jquery.maskedinput.min.js" async></script>

<script type="text/javascript" src="/js/versions/scripts.ru.u1572761624.js" async></script>


<!-- Yandex.Metrika counter -->
<script type="text/javascript" >
   (function(m,e,t,r,i,k,a){m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};
   m[i].l=1*new Date();k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)})
   (window, document, "script", "https://mc.yandex.ru/metrika/tag.js", "ym");

   ym(61730962, "init", {
        clickmap:true,
        trackLinks:true,
        accurateTrackBounce:true,
        webvisor:true,
        trackHash:true
   });
</script>
<noscript><div><img src="https://mc.yandex.ru/watch/61730962" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
<!-- /Yandex.Metrika counter -->
</div>
<script type="application/ld+json">
  {
  "@context": "https://schema.org",
  "@type": "WebSite",
  "name": "Ubuntu - Вопросы",
  "alternateName": "Ubuntu - Вопросы",
  "url": "https://unixconf.ru",
  "potentialAction": {
     "@type": "SearchAction",
     "target": "https://unixconf.ru/search?search={search_term_string}",
     "query-input": "required name=search_term_string"
   }
}
{
  "@context": "https://schema.org",
  "@type": "Organization",
  "name": "Ubuntu - Вопросы",
  "url": "https://unixconf.ru",
  "logo": "https://unixconf.ru/i/logo.png",
  "email": "info@unixconf.ru",
   "telephone": ""

}

</script>
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
</body>
</html>