README (2078B)
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 viewed. 58 59 60 Adding Other Translations 61 ------------------------- 62 This script should work with other translations in the same format as the 63 quran.txt file with the following conditions: 64 65 1. The surahs are in the following format: 66 67 surah number. surah name 68 opening message (e.g., In the Name of Allah) 69 blank line 70 71 2. The ayat start with [surah number:ayah number]. 72 3. There is at least one blank line at the end of a surah (not required for the last surah).