{"id":2259,"date":"2017-12-08T05:59:38","date_gmt":"2017-12-08T05:59:38","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/?p=2259"},"modified":"2020-01-09T09:28:44","modified_gmt":"2020-01-09T09:28:44","slug":"write-script-to-print-nos-as-54321-using-while-loop","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/write-script-to-print-nos-as-54321-using-while-loop\/","title":{"rendered":"Write script to print nos as 5,4,3,2,1 using while loop"},"content":{"rendered":"<p><strong>rajeshkumar created the topic: Write script to print nos as 5,4,3,2,1 using while loop<\/strong><\/p>\n<p>Write script to print nos as 5,4,3,2,1 using while loop.<\/p>\n<p><code>#!\/bin\/bash<br \/>\n#<br \/>\n# Linux Shell Scripting Tutorial 1.05r3, Summer-2002<br \/>\n#<br \/>\n# Written by Vivek G. Gite <vivek@nixcraft.com><br \/>\n#<br \/>\n# Latest version can be found at http:\/\/www.nixcraft.com\/<br \/>\n#<br \/>\n# Q3<br \/>\n# Algo:<br \/>\n#       1) START: set value of i to 5 (since we want to start from 5, if you<br \/>\n#          want to start from other value put that value)<br \/>\n#       2) Start While Loop<br \/>\n#       3) Chechk, Is value of i is zero, If yes goto step 5 else<br \/>\n#          continue with next step<br \/>\n#       4) print i, decement i by 1 (i.e. i=i-1 to goto zero) and<br \/>\n#          goto step 3<br \/>\n#       5) END<br \/>\n#<br \/>\ni=5<br \/>\nwhile test $i != 0<br \/>\ndo<br \/>\n\techo \"$i<br \/>\n\"<br \/>\n\ti=`expr $i - 1`<br \/>\ndone<br \/>\n#<br \/>\n# .\/ch.sh: vivek-tech.com to nixcraft.com referance converted using this tool<br \/>\n# See the tool at http:\/\/www.nixcraft.com\/uniqlinuxfeatures\/tools\/<br \/>\n#<\/code><\/p>\n<p>Regards,<br \/>\nRajesh Kumar<br \/>\nTwitt me @ <a href=\"http:\/\/twitter.com\/RajeshKumarIn\" target=\"_blank\" rel=\"noopener\">twitter.com\/RajeshKumarIn<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>rajeshkumar created the topic: Write script to print nos as 5,4,3,2,1 using while loop Write script to print nos as 5,4,3,2,1 using while loop. #!\/bin\/bash # # Linux Shell Scripting&#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[454],"tags":[278],"class_list":["post-2259","post","type-post","status-publish","format-standard","hentry","category-shell-script","tag-script"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/2259","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=2259"}],"version-history":[{"count":2,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/2259\/revisions"}],"predecessor-version":[{"id":2261,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/2259\/revisions\/2261"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=2259"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=2259"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=2259"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}