{"id":65697,"date":"2021-07-11T04:10:06","date_gmt":"2021-07-11T08:10:06","guid":{"rendered":"http:\/\/bangla.salearningschool.com\/recent-posts\/example-use-of-case-linux-unix-shell-programming-001\/"},"modified":"2021-07-11T04:10:06","modified_gmt":"2021-07-11T08:10:06","slug":"example-use-of-case-linux-unix-shell-programming-001","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=65697","title":{"rendered":"Example use of case #Linux\/Unix: Shell Programming &#8211; 001"},"content":{"rendered":"<p>Example Output:<br \/>\n10 * 1 = 10<br \/>\n10 * 2 = 20<br \/>\n10 * 3 = 30<br \/>\n10 * 4 = 40<br \/>\n10 * 5 = 50<br \/>\n10 * 6 = 60<br \/>\n10 * 7 = 70<br \/>\n10 * 8 = 80<br \/>\n10 * 9 = 90<br \/>\n10 * 10 = 100<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>#!\/bin\/bash<br \/>\nmulti()<br \/>\n{<br \/>\nclear<br \/>\nfor ((i=1;i&lt;=10;i++));<br \/>\ndo<br \/>\necho &#8220;$Y * $i = `expr $Y * $i`&#8221;<br \/>\ndone<br \/>\n}<\/p>\n<p>echo &#8220;Enter your Number&#8221;<br \/>\nread X<\/p>\n<p>case &#8220;$X&#8221; in<\/p>\n<p>1)<\/p>\n<p>Y=1<br \/>\nmulti<br \/>\n;;<\/p>\n<p>2)<\/p>\n<p>Y=2<br \/>\nmulti<br \/>\n;;<\/p>\n<p>3)<\/p>\n<p>Y=3<br \/>\nmulti<br \/>\n;;<\/p>\n<p>4)<\/p>\n<p>Y=4<br \/>\nmulti<br \/>\n;;<\/p>\n<p>5)<\/p>\n<p>Y=5<br \/>\nmulti<br \/>\n;;<\/p>\n<p>6)<\/p>\n<p>Y=6<br \/>\nmulti<br \/>\n;;<\/p>\n<p>7)<\/p>\n<p>Y=7<br \/>\nmulti<br \/>\n;;<\/p>\n<p>8)<\/p>\n<p>Y=8<br \/>\nmulti<br \/>\n;;<\/p>\n<p>9)<\/p>\n<p>Y=9<br \/>\nmulti<br \/>\n;;<\/p>\n<p>10)<\/p>\n<p>Y=10<br \/>\nmulti<br \/>\n;;<\/p>\n<p>esac<br \/>\nexit<\/p>\n<p>&nbsp;<\/p>\n<hr \/>\n<p>&nbsp;<\/p>\n<p>Output<\/p>\n<p>&nbsp;<\/p>\n<p>7 * 1 = 7<br \/>\n7 * 2 = 14<br \/>\n7 * 3 = 21<br \/>\n7 * 4 = 28<br \/>\n7 * 5 = 35<br \/>\n7 * 6 = 42<br \/>\n7 * 7 = 49<br \/>\n7 * 8 = 56<br \/>\n7 * 9 = 63<br \/>\n7 * 10 = 70 From: http:\/\/sitestree.com\/?p=12187<br \/> Categories:Linux\/Unix: Shell Programming &#8211; 001<br \/>Tags:<br \/> Post Data:2018-04-16 18:33:14<\/p>\n<p>\t\tShop Online: <a href='https:\/\/www.ShopForSoul.com\/' target='new' rel=\"noopener\">https:\/\/www.ShopForSoul.com\/<\/a><br \/>\n\t\t(Big Data, Cloud, Security, Machine Learning): Courses: <a href='http:\/\/Training.SitesTree.com' target='new' rel=\"noopener\"> http:\/\/Training.SitesTree.com<\/a><br \/>\n\t\tIn Bengali: <a href='http:\/\/Bangla.SaLearningSchool.com' target='new' rel=\"noopener\">http:\/\/Bangla.SaLearningSchool.com<\/a><br \/>\n\t\t<a href='http:\/\/SitesTree.com' target='new' rel=\"noopener\">http:\/\/SitesTree.com<\/a><br \/>\n\t\t8112223 Canada Inc.\/JustEtc: <a href='http:\/\/JustEtc.net' target='new' rel=\"noopener\">http:\/\/JustEtc.net (Software\/Web\/Mobile\/Big-Data\/Machine Learning) <\/a><br \/>\n\t\tShop Online: <a href='https:\/\/www.ShopForSoul.com'> https:\/\/www.ShopForSoul.com\/<\/a><br \/>\n\t\tMedium: <a href='https:\/\/medium.com\/@SayedAhmedCanada' target='new' rel=\"noopener\"> https:\/\/medium.com\/@SayedAhmedCanada <\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Example Output: 10 * 1 = 10 10 * 2 = 20 10 * 3 = 30 10 * 4 = 40 10 * 5 = 50 10 * 6 = 60 10 * 7 = 70 10 * 8 = 80 10 * 9 = 90 10 * 10 = 100 &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- #!\/bin\/bash multi() &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/bangla.sitestree.com\/?p=65697\">Continue reading<\/a><\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1917],"tags":[],"class_list":["post-65697","post","type-post","status-publish","format-standard","hentry","category-fromsitestree-com","item-wrap"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":65710,"url":"http:\/\/bangla.sitestree.com\/?p=65710","url_meta":{"origin":65697,"position":0},"title":"Another Example of Case and For Loop #Linux\/Unix: Shell Programming &#8211; 001","author":"Author-Check- Article-or-Video","date":"July 12, 2021","format":false,"excerpt":"Output First bash-3.2$ .\/ksh_case_chart.sh Enter your Number 9 9 * 1 = 9 9 * 2 = 18 9 * 3 = 27 9 * 4 = 36 9 * 5 = 45 9 * 6 = 54 9 * 7 = 63 9 * 8 = 72 9 *\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":65716,"url":"http:\/\/bangla.sitestree.com\/?p=65716","url_meta":{"origin":65697,"position":1},"title":"While Loop Example in Shell Programming. Display a Chart #Linux\/Unix: Shell Programming &#8211; 001","author":"Author-Check- Article-or-Video","date":"July 12, 2021","format":false,"excerpt":"Example Output bash-3.2$ .\/while-loop-example.sh Enter your Number 10 10 * 1 = 10 10 * 2 = 20 10 * 3 = 30 10 * 4 = 40 10 * 5 = 50 10 * 6 = 60 10 * 7 = 70 10 * 8 = 80 10 *\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":65687,"url":"http:\/\/bangla.sitestree.com\/?p=65687","url_meta":{"origin":65697,"position":2},"title":"Examples of using variables in a Shell Program #Linux\/Unix: Shell Programming &#8211; 001","author":"Author-Check- Article-or-Video","date":"July 11, 2021","format":false,"excerpt":"#!\/bin\/sh #assign value to a variable and print to the screen NAME=\"Justetc\" echo $NAME #Ask the user to enter a Name echo ################################## echo \"enter name\" #read command is used to take input from the user read X #print the value two times to the screen echo $X echo $X\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":65689,"url":"http:\/\/bangla.sitestree.com\/?p=65689","url_meta":{"origin":65697,"position":3},"title":"Arithmetic Operations using two variables #Linux\/Unix: Shell Programming &#8211; 001","author":"Author-Check- Article-or-Video","date":"July 11, 2021","format":false,"excerpt":"#!\/bin\/sh #will do addition, subtraction, multiplication, and division of two variables X=12 Y=5 #print the values of the variables echo \"X value is: \"$X echo \"Y value is: \"$Y #addition echo \"X + Y\" = `expr $X + $Y` #subtraction echo \"Y - X\" = `expr $Y - $X` #multiplication\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":65693,"url":"http:\/\/bangla.sitestree.com\/?p=65693","url_meta":{"origin":65697,"position":4},"title":"Example use of case in KSH. Show Today&#8217;s Day Name #Linux\/Unix: Shell Programming &#8211; 001","author":"Author-Check- Article-or-Video","date":"July 11, 2021","format":false,"excerpt":"bash-3.2$ cat ksh_case_example_1.sh #!\/bin\/ksh #show today's day name DAY=`date +%a` #show value of $DAY echo $DAY #based on the value of the DAY variable show the day name in full format case \"$DAY\" in Mon) echo \"Monday\" ;; Tue) echo \"Tuesday\" ;; Wed) echo \"Wednesday\" ;; Thu) echo \"Thursday\" ;;\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":65691,"url":"http:\/\/bangla.sitestree.com\/?p=65691","url_meta":{"origin":65697,"position":5},"title":"Take Two values from the user and do arithmetic operations #Linux\/Unix: Shell Programming &#8211; 001","author":"Author-Check- Article-or-Video","date":"July 11, 2021","format":false,"excerpt":"#!\/usr\/bin\/bash clear echo \"Enter First Number\" read x echo \"Enter Second Number\" read y #does not work for \/bin\/sh (( z = $x + $y )) (( a = $x - $y )) (( b = $x * $y )) (( c = $x \/ $y )) #clear echo \"Addition\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/65697","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=65697"}],"version-history":[{"count":0,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/65697\/revisions"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=65697"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=65697"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=65697"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}