From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 098EF138FC7 for ; Mon, 17 Oct 2016 17:39:43 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D6FDC21C060; Mon, 17 Oct 2016 17:39:39 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id AE9FF21C060 for ; Mon, 17 Oct 2016 17:39:39 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 4CE75341258 for ; Mon, 17 Oct 2016 17:39:37 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 105B22EF for ; Mon, 17 Oct 2016 17:39:35 +0000 (UTC) From: "Paul Varner" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Paul Varner" Message-ID: <1476725889.b5e71f6f2ed3483422df611fc2450081c72332ac.fuzzyray@gentoo> Subject: [gentoo-commits] proj/gentoolkit:master commit in: bin/ X-VCS-Repository: proj/gentoolkit X-VCS-Files: bin/eread X-VCS-Directories: bin/ X-VCS-Committer: fuzzyray X-VCS-Committer-Name: Paul Varner X-VCS-Revision: b5e71f6f2ed3483422df611fc2450081c72332ac X-VCS-Branch: master Date: Mon, 17 Oct 2016 17:39:35 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: a9fb153b-e30a-4cd7-8b2e-36840f264b79 X-Archives-Hash: c12967a0304ead19a7193ef88d603737 commit: b5e71f6f2ed3483422df611fc2450081c72332ac Author: Paul Varner gentoo org> AuthorDate: Mon Oct 17 17:38:09 2016 +0000 Commit: Paul Varner gentoo org> CommitDate: Mon Oct 17 17:38:09 2016 +0000 URL: https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=b5e71f6f eread: Fix bash error when the elog directory is empty This fixes the following error from bash which causes an infinite loop. /usr/bin/eread: line 64: break: only meaningful in a `for', `while', or `until' loop X-Gentoo-bug: 597132 X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=597132 bin/eread | 124 +++++++++++++++++++++++++++++++------------------------------- 1 file changed, 62 insertions(+), 62 deletions(-) diff --git a/bin/eread b/bin/eread index fe095a6..2289f2d 100755 --- a/bin/eread +++ b/bin/eread @@ -57,72 +57,72 @@ find_files() { } select_loop() { - ANY_FILES=$(find_files) - - if [[ -z ${ANY_FILES} ]]; then - echo "No log items to read" - break - fi - - echo - echo "This is a list of portage log items. Choose a number to view that file or type q to quit." - echo - - # Pick which file to read - select FILE in ${ANY_FILES}; do - case ${REPLY} in - q) - echo "Quitting" - QUIT="yes" - break - ;; - a) - SORT="alphabet" - ;; - t) - SORT="time" - ;; - *) - if [ -f "$FILE" ]; then - ${PAGER} ${FILE} - read -p "Delete file? [y/N] " DELETE - case ${DELETE} in - q) - echo "Quitting" - QUIT="yes" - break - ;; - y|Y) - rm -f ${FILE} - SUCCESS=$? - if [[ ${SUCCESS} = 0 ]]; then - echo "Deleted ${FILE}" - else - echo "Unable to delete ${FILE}" - fi - ;; - # Empty string defaults to N (save file) - n|N|"") - echo "Saving ${FILE}" - ;; - *) - echo "Invalid response. Saving ${FILE}" - ;; - esac - else - echo - echo "Invalid response." - fi - ;; - esac - break + until [[ -n ${QUIT} ]]; do + ANY_FILES=$(find_files) + + if [[ -z ${ANY_FILES} ]]; then + echo "No log items to read" + break + fi + + echo + echo "This is a list of portage log items. Choose a number to view that file or type q to quit." + echo + + # Pick which file to read + select FILE in ${ANY_FILES}; do + case ${REPLY} in + q) + echo "Quitting" + QUIT="yes" + break + ;; + a) + SORT="alphabet" + ;; + t) + SORT="time" + ;; + *) + if [ -f "$FILE" ]; then + ${PAGER} ${FILE} + read -p "Delete file? [y/N] " DELETE + case ${DELETE} in + q) + echo "Quitting" + QUIT="yes" + break + ;; + y|Y) + rm -f ${FILE} + SUCCESS=$? + if [[ ${SUCCESS} = 0 ]]; then + echo "Deleted ${FILE}" + else + echo "Unable to delete ${FILE}" + fi + ;; + # Empty string defaults to N (save file) + n|N|"") + echo "Saving ${FILE}" + ;; + *) + echo "Invalid response. Saving ${FILE}" + ;; + esac + else + echo + echo "Invalid response." + fi + ;; + esac + break + done done } pushd ${ELOGDIR} > /dev/null -until [[ -n ${QUIT} ]]; do - select_loop -done +select_loop popd > /dev/null