| 1 | #! /bin/bash |
| 2 | # Hijri Terminal 3.2 |
| 3 | # Under Waqf License |
| 4 | # By Mosaab Alzoubi ([email protected] - facebook.com/moceap) |
| 5 | # Almasa Project |
| 6 | # 1436-10-5 |
| 7 | #--------------------------------------------------------------- |
| 8 | #--------------------------------------------------------------- |
| 9 | #--------------------------------------------------------------- |
| 10 | ver=$(hijri -v) |
| 11 | arg="$@" |
| 12 | arg1="$1" |
| 13 | arg2="$2" |
| 14 | arg3="$3" |
| 15 | arg4="$4" |
| 16 | arg5="$5" |
| 17 | about="$(hijri -a arabic)" |
| 18 | nday=$(date +%u) |
| 19 | day=$(hijri -d) |
| 20 | month=$(hijri -m) |
| 21 | year=$(hijri -y) |
| 22 | if [ "$arg1" = "معين" ] |
| 23 | then |
| 24 | nday=$arg5 |
| 25 | day=$arg4 |
| 26 | month=$arg3 |
| 27 | year=$arg2 |
| 28 | if [ "$day" = "" ] ; then echo "البيانات ناقصة" ; exit ; fi |
| 29 | if [ "$month" = "" ] ; then echo "البيانات ناقصة" ; exit ; fi |
| 30 | if [ "$year" = "" ] ; then echo "البيانات ناقصة" ; exit ; fi |
| 31 | con="`echo "$arg" | grep رسومي`" |
| 32 | if [ ! "$con" = "" ] ; then arg1="رسومي" ; fi |
| 33 | fi |
| 34 | n="${#year}" |
| 35 | men="من شهر" |
| 36 | sana="سنة" |
| 37 | help="مساعدة :: |
| 38 | |
| 39 | لإظهار التاريخ الهجري لهذا اليوم شغل البرنامج بدون أي كلمة بعد الأمر هجري . |
| 40 | لإظهار التاريخ بشكل رسومي أدخل كلمة رسومي مباشرة بعد الأمر هجري . |
| 41 | |
| 42 | لتحويل التاريخ الهجري من النمط الرقمي إلى النمط المكتوب استعمل الصيغة التالية : |
| 43 | هجري معين <سنة> <شهر> <يوم> |
| 44 | وإضافة كلمة رسومي في الآخر في حال الرغبة بتفعيل الشكل الرسومي |
| 45 | مثال :: |
| 46 | هجري معين 1434 7 22 |
| 47 | النتيجة : |
| 48 | الثاني و العشرين من شهر رجب سنة أربع وثلاثين وأربعمئة وألف |
| 49 | |
| 50 | لإظهار معلومات عن البرنامج أدخل كلمة حول بعد الأمر هجري . |
| 51 | لإظهار هذه المساعدة اكتب مساعدة بعد الأمر هجري ." |
| 52 | if [ "$nday" = "1" ] ; then tnday="الإثنين" ; fi |
| 53 | if [ "$nday" = "2" ] ; then tnday="الثلاثاء" ; fi |
| 54 | if [ "$nday" = "3" ] ; then tnday="الأربعاء" ; fi |
| 55 | if [ "$nday" = "4" ] ; then tnday="الخميس" ; fi |
| 56 | if [ "$nday" = "5" ] ; then tnday="الجمعة" ; fi |
| 57 | if [ "$nday" = "6" ] ; then tnday="السبت" ; fi |
| 58 | if [ "$nday" = "7" ] ; then tnday="الأحد" ; fi |
| 59 | if [ "$day" = "1" ] ; then tday="الأول" ; fi |
| 60 | if [ "$day" = "2" ] ; then tday="الثاني" ; fi |
| 61 | if [ "$day" = "3" ] ; then tday="الثالث" ; fi |
| 62 | if [ "$day" = "4" ] ; then tday="الرابع" ; fi |
| 63 | if [ "$day" = "5" ] ; then tday="الخامس" ; fi |
| 64 | if [ "$day" = "6" ] ; then tday="السادس" ; fi |
| 65 | if [ "$day" = "7" ] ; then tday="السابع" ; fi |
| 66 | if [ "$day" = "8" ] ; then tday="الثامن" ; fi |
| 67 | if [ "$day" = "9" ] ; then tday="التاسع" ; fi |
| 68 | if [ "$day" = "10" ] ; then tday="العاشر" ; fi |
| 69 | if [ "$day" = "11" ] ; then tday="الحادي عشر" ; fi |
| 70 | if [ "$day" = "12" ] ; then tday="الثاني عشر" ; fi |
| 71 | if [ "$day" = "13" ] ; then tday="الثالث عشر" ; fi |
| 72 | if [ "$day" = "14" ] ; then tday="الرابع عشر" ; fi |
| 73 | if [ "$day" = "15" ] ; then tday="الخامس عشر" ; fi |
| 74 | if [ "$day" = "16" ] ; then tday="السادس عشر" ; fi |
| 75 | if [ "$day" = "17" ] ; then tday="السابع عشر" ; fi |
| 76 | if [ "$day" = "18" ] ; then tday="الثامن عشر" ; fi |
| 77 | if [ "$day" = "19" ] ; then tday="التاسع عشر" ; fi |
| 78 | if [ "$day" = "20" ] ; then tday="العشرين" ; fi |
| 79 | if [ "$day" = "21" ] ; then tday="الحادي و العشرين" ; fi |
| 80 | if [ "$day" = "22" ] ; then tday="الثاني و العشرين" ; fi |
| 81 | if [ "$day" = "23" ] ; then tday="الثالث و العشرين" ; fi |
| 82 | if [ "$day" = "24" ] ; then tday="الرابع و العشرين" ; fi |
| 83 | if [ "$day" = "25" ] ; then tday="الخامس و العشرين" ; fi |
| 84 | if [ "$day" = "26" ] ; then tday="السادس و العشرين" ; fi |
| 85 | if [ "$day" = "27" ] ; then tday="السابع و العشرين" ; fi |
| 86 | if [ "$day" = "28" ] ; then tday="الثامن و العشرين" ; fi |
| 87 | if [ "$day" = "29" ] ; then tday="التاسع و العشرين" ; fi |
| 88 | if [ "$day" = "30" ] ; then tday="الثلاثين" ; fi |
| 89 | if [ "$month" = "1" ] ; then tmonth="محرم" ; fi |
| 90 | if [ "$month" = "2" ] ; then tmonth="صفر" ; fi |
| 91 | if [ "$month" = "3" ] ; then tmonth="ربيع الأول" ; fi |
| 92 | if [ "$month" = "4" ] ; then tmonth="ربيع الثاني" ; fi |
| 93 | if [ "$month" = "5" ] ; then tmonth="جمادى الأولى" ; fi |
| 94 | if [ "$month" = "6" ] ; then tmonth="جمادى الثانية" ; fi |
| 95 | if [ "$month" = "7" ] ; then tmonth="رجب" ; fi |
| 96 | if [ "$month" = "8" ] ; then tmonth="شعبان" ; fi |
| 97 | if [ "$month" = "9" ] ; then tmonth="رمضان" ; fi |
| 98 | if [ "$month" = "10" ] ; then tmonth="شوال" ; fi |
| 99 | if [ "$month" = "11" ] ; then tmonth="ذي القعدة" ; fi |
| 100 | if [ "$month" = "12" ] ; then tmonth="ذي الحجة" ; fi |
| 101 | if [ "$n" = "1" ] ; then |
| 102 | firsty="$year" ; fi |
| 103 | if [ "$n" = "2" ] ; then |
| 104 | firsty="`echo $year | cut -c 2`" |
| 105 | secondy="`echo $year | cut -c 1`"; fi |
| 106 | if [ "$n" = "3" ] ; then |
| 107 | firsty="`echo $year | cut -c 3`" |
| 108 | secondy="`echo $year | cut -c 2`" |
| 109 | thirdy="`echo $year | cut -c 1`"; fi |
| 110 | if [ "$n" = "4" ] ; then |
| 111 | firsty="`echo $year | cut -c 4`" |
| 112 | secondy="`echo $year | cut -c 3`" |
| 113 | thirdy="`echo $year | cut -c 2`" |
| 114 | forthy="`echo $year | cut -c 1`"; fi |
| 115 | if [ "$n" -gt "4" ] ; then |
| 116 | echo "عذراً يدعم هذا البرنامج السنوات الهجرية حتى 9999 ويمكن التعديل عليه كونه مفتوح المصدر ، فلا تبخل بتطويره إن رأيت الحاجة لذلك" |
| 117 | exit ; fi |
| 118 | bel() |
| 119 | { |
| 120 | if [ "$firsty" = "0" ] ; then tfirsty="عشر" ; fi |
| 121 | if [ "$firsty" = "1" ] ; then tfirsty="أحد عشر" ; fi |
| 122 | if [ "$firsty" = "2" ] ; then tfirsty="إثني عشر" ; fi |
| 123 | if [ "$firsty" = "3" ] ; then tfirsty="ثلاث عشر" ; fi |
| 124 | if [ "$firsty" = "4" ] ; then tfirsty="أربع عشر" ; fi |
| 125 | if [ "$firsty" = "5" ] ; then tfirsty="خمس عشر" ; fi |
| 126 | if [ "$firsty" = "6" ] ; then tfirsty="ست عشر" ; fi |
| 127 | if [ "$firsty" = "7" ] ; then tfirsty="سبع عشر" ; fi |
| 128 | if [ "$firsty" = "8" ] ; then tfirsty="ثمان عشر" ; fi |
| 129 | if [ "$firsty" = "9" ] ; then tfirsty="تسع عشر" ; fi |
| 130 | } |
| 131 | akthar() |
| 132 | { |
| 133 | if [ "$firsty" = "0" ] ; then tfirsty="" ; fi |
| 134 | if [ "$firsty" = "1" ] ; then tfirsty="واحد" ; fi |
| 135 | if [ "$firsty" = "2" ] ; then tfirsty="اثنين" ; fi |
| 136 | if [ "$firsty" = "3" ] ; then tfirsty="ثلاث" ; fi |
| 137 | if [ "$firsty" = "4" ] ; then tfirsty="أربع" ; fi |
| 138 | if [ "$firsty" = "5" ] ; then tfirsty="خمس" ; fi |
| 139 | if [ "$firsty" = "6" ] ; then tfirsty="ست" ; fi |
| 140 | if [ "$firsty" = "7" ] ; then tfirsty="سبع" ; fi |
| 141 | if [ "$firsty" = "8" ] ; then tfirsty="ثمان" ; fi |
| 142 | if [ "$firsty" = "9" ] ; then tfirsty="تسع" ; fi |
| 143 | } |
| 144 | if [ "$secondy" = "0" ] ; then tsecondy="" ; fi |
| 145 | if [ "$secondy" = "1" ] ; then bel ; else akthar ; fi |
| 146 | if [ "$secondy" = "2" ] ; then tsecondy="وعشرين" ; fi |
| 147 | if [ "$secondy" = "3" ] ; then tsecondy="وثلاثين" ; fi |
| 148 | if [ "$secondy" = "4" ] ; then tsecondy="وأربعين" ; fi |
| 149 | if [ "$secondy" = "5" ] ; then tsecondy="وخمسين" ; fi |
| 150 | if [ "$secondy" = "6" ] ; then tsecondy="وستين" ; fi |
| 151 | if [ "$secondy" = "7" ] ; then tsecondy="وسبعين" ; fi |
| 152 | if [ "$secondy" = "8" ] ; then tsecondy="وثمانين" ; fi |
| 153 | if [ "$secondy" = "9" ] ; then tsecondy="وتسعين" ; fi |
| 154 | if [ "$thirdy" = "0" ] ; then thirdy="" ; fi |
| 155 | if [ "$thirdy" = "1" ] ; then thirdy="ومئة" ; fi |
| 156 | if [ "$thirdy" = "2" ] ; then thirdy="ومئتين" ; fi |
| 157 | if [ "$thirdy" = "3" ] ; then thirdy="وثلاثمئة" ; fi |
| 158 | if [ "$thirdy" = "4" ] ; then thirdy="وأربعمئة" ; fi |
| 159 | if [ "$thirdy" = "5" ] ; then thirdy="وخمسمئة" ; fi |
| 160 | if [ "$thirdy" = "6" ] ; then thirdy="وستمئة" ; fi |
| 161 | if [ "$thirdy" = "7" ] ; then thirdy="وسبعمئة" ; fi |
| 162 | if [ "$thirdy" = "8" ] ; then thirdy="وثمانمئة" ; fi |
| 163 | if [ "$thirdy" = "9" ] ; then thirdy="وتسعمئة" ; fi |
| 164 | if [ "$forthy" = "0" ] ; then forthy="" ; fi |
| 165 | if [ "$forthy" = "1" ] ; then forthy="وألف" ; fi |
| 166 | if [ "$forthy" = "2" ] ; then forthy="وألفين" ; fi |
| 167 | if [ "$forthy" = "3" ] ; then forthy="وثلاث آلاف" ; fi |
| 168 | if [ "$forthy" = "4" ] ; then forthy="وأربع آلاف" ; fi |
| 169 | if [ "$forthy" = "5" ] ; then forthy="وخمس آلاف" ; fi |
| 170 | if [ "$forthy" = "6" ] ; then forthy="وست آلاف" ; fi |
| 171 | if [ "$forthy" = "7" ] ; then forthy="وسبع آلاف" ; fi |
| 172 | if [ "$forthy" = "8" ] ; then forthy="وثمان آلاف" ; fi |
| 173 | if [ "$forthy" = "9" ] ; then forthy="وتسع آلاف" ; fi |
| 174 | hijridate="`echo $tnday $tday $men $tmonth $sana $tfirsty $tsecondy $thirdy $forthy | sed "s: : :g" | sed "s: : :g"`" |
| 175 | h_gnome() |
| 176 | { |
| 177 | zenity --title="هجري $ver" --info --text="$hijridate" |
| 178 | } |
| 179 | h_kde() |
| 180 | { |
| 181 | kdialog --title="هجري $ver" --msgbox "$hijridate" |
| 182 | } |
| 183 | h_gui() |
| 184 | { |
| 185 | if test -x "`which zenity 2>/dev/null`" |
| 186 | then |
| 187 | h_gnome |
| 188 | elif test -x "`which kdialog 2>/dev/null`" |
| 189 | then |
| 190 | h_kde |
| 191 | else echo "لا تتوفر واجهة رسومية مدعومة مثبتة" |
| 192 | fi |
| 193 | } |
| 194 | if [ "$arg1" = "رسومي" ] |
| 195 | then h_gui |
| 196 | elif [ "$arg1" = "حول" ] |
| 197 | then echo "$about" ; exit |
| 198 | elif [ "$arg1" = "مساعدة" ] |
| 199 | then echo "$help" ; exit |
| 200 | elif [ "$arg1" = "--help" ] |
| 201 | then echo "$help" ; exit |
| 202 | elif [ "$arg1" = "مختصر" ] |
| 203 | then echo "$day $tmonth $year" ; exit |
| 204 | else echo "$hijridate" |
| 205 | fi |
| 206 | #--------------------------------------------------------------- |
| 207 | #----Allah-all-thanked-to-help-me-to-write-this-program--------- |
| 208 | #----and-I-ask-him-to-make-the-benefit-for-you------------------ |
| 209 | #----allah-can-do-that------------------------------------------ |
| 210 | #--------------------------------------------------------------- |
| 211 | #----With-our-best-wishes--------------------------------------- |
| 212 | #----almasa-project--------------------------------------------- |
| 213 | #--------------------------------------------------------------- |