{"id":14152,"date":"2018-04-15T21:28:05","date_gmt":"2018-04-16T01:28:05","guid":{"rendered":"http:\/\/bangla.salearningschool.com\/recent-posts\/?p=14152"},"modified":"2018-04-15T21:29:11","modified_gmt":"2018-04-16T01:29:11","slug":"%e0%a6%b6%e0%a7%87%e0%a6%b2-%e0%a6%aa%e0%a7%8d%e0%a6%b0%e0%a7%8b%e0%a6%97%e0%a7%8d%e0%a6%b0%e0%a6%be%e0%a6%ae%e0%a6%bf%e0%a6%82-%e0%a6%8f-for-%e0%a6%b2%e0%a7%81%e0%a6%aa-%e0%a6%8f%e0%a6%ac%e0%a6%82","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=14152","title":{"rendered":"\u09b6\u09c7\u09b2 \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae\u09bf\u0982 \u098f for \u09b2\u09c1\u09aa \u098f\u09ac\u0982 \u09ab\u09be\u0982\u09b6\u09a8 \u098f\u09b0 \u09ac\u09cd\u09af\u09ac\u09b9\u09be\u09b0\u0964 Use of For Loop and Function in Shell Programming"},"content":{"rendered":"<p>bash-3.2$ cat multiplication.sh<br \/>\n#!\/bin\/bash<\/p>\n<p># Example use of function\/method declaration in Shell Programming<br \/>\n# Example use of for loop<\/p>\n<p>#a function that will multiply 1 to 10 with 5<br \/>\nmultiplication()<br \/>\n{<br \/>\n   x=5<br \/>\n   for i in {1..10}<br \/>\n   do<br \/>\n      echo $i<br \/>\n      echo &#8220;the multiplication result is:&#8221; $(($i*$x))<br \/>\n   done<br \/>\n}<\/p>\n<p>echo &#8220;Print 1 to 10; also multiply each number with 5 and show the multiplication result&#8221;<br \/>\nmultiplication<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\nOutput &#8211; \u09ab\u09b2\u09be\u09ab\u09b2<\/p>\n<p>bash-3.2$ .\/multiplication.sh<br \/>\nPrint 1 to 10; also multiply each number with 5 and show the multiplication result<br \/>\n1<br \/>\nthe multiplication result is: 5<br \/>\n2<br \/>\nthe multiplication result is: 10<br \/>\n3<br \/>\nthe multiplication result is: 15<br \/>\n4<br \/>\nthe multiplication result is: 20<br \/>\n5<br \/>\nthe multiplication result is: 25<br \/>\n6<br \/>\nthe multiplication result is: 30<br \/>\n7<br \/>\nthe multiplication result is: 35<br \/>\n8<br \/>\nthe multiplication result is: 40<br \/>\n9<br \/>\nthe multiplication result is: 45<br \/>\n10<br \/>\nthe multiplication result is: 50<\/p>\n","protected":false},"excerpt":{"rendered":"<p>bash-3.2$ cat multiplication.sh #!\/bin\/bash # Example use of function\/method declaration in Shell Programming # Example use of for loop #a function that will multiply 1 to 10 with 5 multiplication() { x=5 for i in {1..10} do echo $i echo &#8220;the multiplication result is:&#8221; $(($i*$x)) done } echo &#8220;Print 1 to 10; also multiply each &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/bangla.sitestree.com\/?p=14152\">Continue reading<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1888],"tags":[],"class_list":["post-14152","post","type-post","status-publish","format-standard","hentry","category---shell-programming","item-wrap"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":14165,"url":"http:\/\/bangla.sitestree.com\/?p=14165","url_meta":{"origin":14152,"position":0},"title":"For \u09b2\u09c1\u09aa \u098f\u09b0 \u09ac\u09cd\u09af\u09ac\u09b9\u09be\u09b0","author":"Sayed","date":"April 16, 2018","format":false,"excerpt":"bash-3.2$ cat multiplication.sh #!\/bin\/bash # Example use of function\/method declaration in Shell Programming # Example use of for loop #a function that will multiply 1 to 10 with 5 multiplication() { x=5 for i in {1..10} do echo $i echo \"the multiplication result is:\" $(($i*$x)) done } echo \"Print 1\u2026","rel":"","context":"In &quot;\u09b6\u09c7\u09b2 \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae\u09bf\u0982 - Shell Programming&quot;","block_context":{"text":"\u09b6\u09c7\u09b2 \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae\u09bf\u0982 - Shell Programming","link":"http:\/\/bangla.sitestree.com\/?cat=1888"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":65695,"url":"http:\/\/bangla.sitestree.com\/?p=65695","url_meta":{"origin":14152,"position":1},"title":"Use of For Loops and Functions in Shell Programming #Linux\/Unix: Shell Programming &#8211; 001","author":"Author-Check- Article-or-Video","date":"July 11, 2021","format":false,"excerpt":"bash-3.2$ cat multiplication.sh #!\/bin\/bash # Example use of function\/method declaration in Shell Programming # Example use of for loop #a function that will multiply 1 to 10 with 5 multiplication() { x=5 for i in {1..10} do echo $i echo \"the multiplication result is:\" $(($i*$x)) done } echo \"Print 1\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":14152,"position":2},"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":14141,"url":"http:\/\/bangla.sitestree.com\/?p=14141","url_meta":{"origin":14152,"position":3},"title":"\u098f\u09b0\u09bf\u09a5\u09ae\u09c7\u099f\u09bf\u0995 \u0985\u09aa\u09be\u09b0\u09c7\u09b6\u09a8 \u09a6\u09c1\u099f\u09bf \u09ad\u09c7\u09b0\u09bf\u09af\u09bc\u09c7\u09ac\u09b2 \u09ac\u09cd\u09af\u09ac\u09b9\u09be\u09b0 \u0995\u09b0\u09c7","author":"Sayed","date":"April 15, 2018","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;\u09b6\u09c7\u09b2 \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae\u09bf\u0982 - Shell Programming&quot;","block_context":{"text":"\u09b6\u09c7\u09b2 \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae\u09bf\u0982 - Shell Programming","link":"http:\/\/bangla.sitestree.com\/?cat=1888"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":14144,"url":"http:\/\/bangla.sitestree.com\/?p=14144","url_meta":{"origin":14152,"position":4},"title":"\u0997\u09be\u09a3\u09bf\u09a4\u09bf\u0995 \u0985\u09aa\u09be\u09b0\u09c7\u09b6\u09a8 &#8211; \u09ac\u09cd\u09af\u09ac\u09b9\u09be\u09b0\u0995\u09be\u09b0\u09c0 \u09a5\u09c7\u0995\u09c7 \u09a6\u09c1\u099f\u09bf \u09ae\u09be\u09a8 \u09ac\u09cd\u09af\u09ac\u09b9\u09be\u09b0 \u0995\u09b0\u09c7 : Arithmetic operations using two values from the user","author":"Sayed","date":"April 15, 2018","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;\u09b6\u09c7\u09b2 \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae\u09bf\u0982 - Shell Programming&quot;","block_context":{"text":"\u09b6\u09c7\u09b2 \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae\u09bf\u0982 - Shell Programming","link":"http:\/\/bangla.sitestree.com\/?cat=1888"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":14173,"url":"http:\/\/bangla.sitestree.com\/?p=14173","url_meta":{"origin":14152,"position":5},"title":"\u09b6\u09c7\u09b2 \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae\u09bf\u0982 while \u09b2\u09c1\u09aa \u098f\u09b0 \u0989\u09a6\u09be\u09b9\u09b0\u09a3 \u0964 \u098f\u0995\u099f\u09bf \u099a\u09be\u09b0\u09cd\u099f \u09aa\u09cd\u09b0\u09a6\u09b0\u09cd\u09b6\u09a8 \u0995\u09b0\u09c1\u09a8","author":"Sayed","date":"April 16, 2018","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;\u09b6\u09c7\u09b2 \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae\u09bf\u0982 - Shell Programming&quot;","block_context":{"text":"\u09b6\u09c7\u09b2 \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae\u09bf\u0982 - Shell Programming","link":"http:\/\/bangla.sitestree.com\/?cat=1888"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/14152","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\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=14152"}],"version-history":[{"count":2,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/14152\/revisions"}],"predecessor-version":[{"id":14154,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/14152\/revisions\/14154"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=14152"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=14152"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=14152"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}