quran

English translation of the Quran from the command line
git clone https://riazj.com/git/quran
Log | Files | Refs | README | LICENSE

commit a0e2567f3139475abec20ecb80648a0a70b15c3c
parent 760c69e4fb8c6675b678bbb7e6f1fd51287f6128
Author: Riaz <riaz@riazj.com>
Date:   Wed, 23 Jul 2025 15:27:28 -0700

Remove unneeded error messages

get_surah_number already searches for a surah. Don't show error
messages due to SIGPIPE from the while loops.

Diffstat:
MREADME | 9+--------
Mquran | 6+++---
2 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/README b/README @@ -54,14 +54,7 @@ or a script like this: /usr/local/bin/quran "$@" | fold -s | "${PAGER:-less}" -Use less with -R so that if grep returns an output with color, it can be -viewed. The examples above can result in the script returning an error when the -pager is closed (exit code 141) before the entire range of surahs or ayat have -been found. To avoid this, the output can be redirected to a file that the -pager opens. However, the pager will take more time to open since the file must -be written first. - - /usr/local/bin/quran "$@" | fold -s > tmpfile; "${PAGER:-less}" tmpfile +Use less with -R so that if grep returns an output with color, it can be viewed. Adding Other Translations diff --git a/quran b/quran @@ -46,14 +46,14 @@ read_ayat() { [ "$start_ayah" -le "$end_ayah" ] || error "$start_ayah-$end_ayah: invalid range of ayat" while [ "$start_ayah" -le "$end_ayah" ]; do - grep "\[$surah:$start_ayah\]" "$QURAN" || error "$surah:$start_ayah: ayah not found" + grep "\[$surah:$start_ayah\]" "$QURAN" start_ayah=$((start_ayah+1)) done exit } read_surah() { - grep -B3 "\[$1:" "$QURAN" || error "$1: surah not found" + grep -B3 "\[$1:" "$QURAN" exit } @@ -62,7 +62,7 @@ read_surahs() { [ "$start_surah" -le "$end_surah" ] || error "$start_surah-$end_surah: invalid range of surahs" while [ "$start_surah" -le "$end_surah" ]; do - grep -B3 -A1 "\[$start_surah:" "$QURAN" || error "$start_surah: surah not found" + grep -B3 -A1 "\[$start_surah:" "$QURAN" start_surah=$((start_surah+1)) done exit