aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Varner <fuzzyray@gentoo.org>2016-10-17 12:38:09 -0500
committerPaul Varner <fuzzyray@gentoo.org>2016-10-17 12:38:09 -0500
commitb5e71f6f2ed3483422df611fc2450081c72332ac (patch)
tree0564374378fc6c6c123225bd90eff43bd09cfdc2
parentgentoolkit/package.py: Fix dblink call py3 compatibility bug 575788 (diff)
downloadgentoolkit-b5e71f6f.tar.gz
gentoolkit-b5e71f6f.tar.bz2
gentoolkit-b5e71f6f.zip
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
-rwxr-xr-xbin/eread124
1 files 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