{"id":14173,"date":"2018-04-16T21:10:28","date_gmt":"2018-04-17T01:10:28","guid":{"rendered":"http:\/\/bangla.salearningschool.com\/recent-posts\/?p=14173"},"modified":"2018-04-16T21:10:28","modified_gmt":"2018-04-17T01:10:28","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-while-%e0%a6%b2%e0%a7%81%e0%a6%aa-%e0%a6%8f%e0%a6%b0-%e0%a6%89%e0%a6%a6","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=14173","title":{"rendered":"\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"},"content":{"rendered":"<p>Example Output<\/p>\n<p>bash-3.2$ .\/while-loop-example.sh<br \/>\nEnter your Number<br \/>\n10<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>The Code<\/p>\n<p>#!\/bin\/ksh<\/p>\n<p>#example : how to use while loop in shell programming<\/p>\n<p>multiplication()<br \/>\n{<\/p>\n<p>#clear<br \/>\ni=1<br \/>\nwhile (( i <= 10 ))\ndo\necho \"$Y * $i = `expr $Y \\* $i`\"\n(( i = i + 1 ))\ndone\n\n}\n\necho \"Enter your Number\"\nread X\n\ncase \"$X\" in\n\n1)\nY=1\nmultiplication\n;;\n\n2)\n\nY=2\nmultiplication\n;;\n\n3)\n\nY=3\nmultiplication\n;;\n\n4)\n\nY=4\nmultiplication\n;;\n\n5)\n\nY=5\nmultiplication\n;;\n\n6)\n\nY=6\nmultiplication\n;;\n\n7)\n\nY=7\nmultiplication\n;;\n\n8)\n\nY=8\nmultiplication\n;;\n\n9)\n\nY=9\nmultiplication\n;;\n\n10)\n\nY=10\nmultiplication\n;;\n\nesac\nexit\n<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 * 9 = 90 10 * &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/bangla.sitestree.com\/?p=14173\">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-14173","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":14152,"url":"http:\/\/bangla.sitestree.com\/?p=14152","url_meta":{"origin":14173,"position":0},"title":"\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","author":"Sayed","date":"April 15, 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":14169,"url":"http:\/\/bangla.sitestree.com\/?p=14169","url_meta":{"origin":14173,"position":1},"title":"\u09b6\u09c7\u09b2 \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae\u09bf\u0982 \u098f if-then-else \u098f\u09b0 \u0989\u09a6\u09be\u09b9\u09b0\u09a3","author":"Sayed","date":"April 16, 2018","format":false,"excerpt":"#!\/bin\/sh #If then else example #if elif else NOF=5 if [ $NOF -eq 27 ] then echo \"No of files and directories = 27\" elif [ $NOF -gt 27 ] then echo \"No of files are dir are greator than 27\" else echo \"No of files and directories are less\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":14175,"url":"http:\/\/bangla.sitestree.com\/?p=14175","url_meta":{"origin":14173,"position":2},"title":"if-then \u098f\u09b0 \u09ac\u09cd\u09af\u09ac\u09b9\u09be\u09b0 &#8211; \u09b6\u09c7\u09b2 \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae\u09bf\u0982-\u098f","author":"Sayed","date":"April 16, 2018","format":false,"excerpt":"#!\/bin\/sh #count the number of files in current directory, and check if the number is equal to or greater than or less than 26 #NOF represents number of files NOF=`ls -l | wc -l` if [ $NOF -eq 26 ] then echo \"No of files and directories is equal to\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":14165,"url":"http:\/\/bangla.sitestree.com\/?p=14165","url_meta":{"origin":14173,"position":3},"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":14159,"url":"http:\/\/bangla.sitestree.com\/?p=14159","url_meta":{"origin":14173,"position":4},"title":"\u09e9\u09e6 \u09b8\u09c7\u0995\u09c7\u09a8\u09cd\u09a1 \u09aa\u09b0 \u09aa\u09b0 \u09af\u09c7 \u09b8\u09ae\u09b8\u09cd\u09a4 \u09b6\u09c7\u09b2 \u09b0\u09be\u09a8 \u0995\u09b0\u099b\u09c7 \u09a4\u09be\u09a6\u09c7\u09b0 \u09a1\u09be\u099f\u09be \u098f\u0995\u099f\u09be \u09b2\u0997 \u09ab\u09be\u0987\u09b2 \u098f \u09b8\u09c7\u09ad \u0995\u09b0\u09a4\u09c7 \u09b9\u09ac\u09c7","author":"Sayed","date":"April 16, 2018","format":false,"excerpt":"#!\/bin\/sh #find all currently running shells and create in full listing form for them . Log the data into a file in every 30 secs # -e means currentl running # -f means full format output # sleep takes parameters in seconds ps -ef | grep shell >> process.log sleep\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":14148,"url":"http:\/\/bangla.sitestree.com\/?p=14148","url_meta":{"origin":14173,"position":5},"title":"\u09b6\u09c7\u09b2 &#8211; case \u098f\u09b0 \u09ac\u09cd\u09af\u09ac\u09b9\u09be\u09b0 ksh &#8211; \u098f\u0964 Example use of Case in KSH. Show Today&#8217;s Day Name","author":"Sayed","date":"April 15, 2018","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;\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\/14173","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=14173"}],"version-history":[{"count":1,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/14173\/revisions"}],"predecessor-version":[{"id":14174,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/14173\/revisions\/14174"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=14173"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=14173"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=14173"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}