quran

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

README (2476B)


      1 English translation of the Quran from the command line
      2 
      3 
      4 Installation
      5 ------------
      6 Edit the makefile if needed. The files are copied to /usr/local by default.
      7 
      8 # make install
      9 
     10 
     11 Usage
     12 -----
     13 Options:
     14   -s  search
     15   -l  list surahs
     16   -h  show this message
     17 
     18 Examples:
     19   quran falaq       read surah Falaq
     20   quran falaq:5     read surah Falaq, ayah 5
     21   quran falaq:3-5   read surah Falaq, ayat 3-5
     22   quran falaq-naas  read surah Falaq to surah Naas
     23 
     24   quran 113         read surah 113
     25   quran 113:5       read surah 113, ayah 5
     26   quran 113:3-5     read surah 113, ayat 3-5
     27   quran 113-114     read surah 113 to surah 114
     28 
     29 
     30 Improvements
     31 ------------
     32 This was forked from Samiul Ahmed's repository (https://github.com/samiuljoy/quran).
     33 The following is a summary of the improvements made:
     34 
     35 - Added error messages
     36 - Added portability with BSD grep by simplifying the search patterns
     37 - Decreased the number of lines in quran.txt from ~7140 to ~6700 by removing
     38   unnecessary blank lines and splitting the list of surahs into a separate file
     39 - Decreased the number of SLOC from ~130 to ~70
     40 - Increased performance by removing unnecessary cut, sed, and xargs commands
     41 - Improved readability by dividing the code into functions
     42 - For flexibility with text operations, the output is in standard output
     43   instead of being piped into less
     44 
     45 To open the output in a pager, use a function like this:
     46 
     47 	quran() {
     48 	  /usr/local/bin/quran "$@" | fold -s | "${PAGER:-less}"
     49 	}
     50 
     51 or a script like this:
     52 
     53 	#!/bin/sh
     54 
     55 	/usr/local/bin/quran "$@" | fold -s | "${PAGER:-less}"
     56 
     57 Use less with -R so that if grep returns an output with color, it can be
     58 viewed. The examples above can result in the script returning an error when the
     59 pager is closed (exit code 141) before the entire range of surahs or ayat have
     60 been found. To avoid this, the output can be redirected to a file that the
     61 pager opens. However, the pager will take more time to open since the file must
     62 be written first.
     63 
     64 	/usr/local/bin/quran "$@" | fold -s > tmpfile; "${PAGER:-less}" tmpfile
     65 
     66 
     67 Adding Other Translations
     68 -------------------------
     69 This script should work with other translations in the same format as the
     70 quran.txt file with the following conditions:
     71 
     72 1. The surahs are in the following format:
     73 
     74 	surah number. surah name
     75 	opening message (e.g., In the Name of Allah)
     76 	blank line
     77 
     78 2. The ayat start with [surah number:ayah number].
     79 3. There is at least one blank line at the end of a surah (not required for the last surah).