{"id":706,"date":"2013-03-01T14:36:09","date_gmt":"2013-03-01T20:36:09","guid":{"rendered":"http:\/\/benincosa.com\/blog\/?p=706"},"modified":"2014-11-19T11:24:32","modified_gmt":"2014-11-19T17:24:32","slug":"use-bash-to-teach-kids-to-program","status":"publish","type":"post","link":"https:\/\/benincosa.com\/?p=706","title":{"rendered":"Use Bash to teach kids to program"},"content":{"rendered":"<p>I&#8217;m going to try to teach my 9 year old to program this weekend. \u00a0My first thought was to do scratch, and that seems kind of good, but I think BASH might just be a great place to go as well.<\/p>\n<p>Bash is found on the MAC and Linux which comprises every computer in our house. \u00a0(we have a few windows VMs here and there but nothing we use). \u00a0And bash is fun cause you can get familiar with the command line. \u00a0We&#8217;ll start by using pico maybe? \u00a0And do a simple hello world program first:<\/p>\n<p>Program #1:<\/p>\n<blockquote><p>#!\/bin\/bash<br \/>\necho &#8220;Hello World!&#8221;<\/p><\/blockquote>\n<p>That&#8217;s pretty easy, but the next fun thing is to make it ask and answer a question:<\/p>\n<p>Program #2:<\/p>\n<blockquote><p>#!\/bin\/bash<\/p>\n<p>echo &#8220;What is your favorite color?&#8221;<br \/>\nread color<br \/>\necho &#8220;${color} is a nice color&#8221;<\/p>\n<p>&nbsp;<\/p><\/blockquote>\n<p>Program #3:<\/p>\n<blockquote><p>#!\/bin\/bash<\/p>\n<p>echo &#8220;What is your favorite color?&#8221;<br \/>\nread color<br \/>\necho &#8220;${color} is a nice color&#8221;<br \/>\nif [ &#8220;$color&#8221; == &#8220;red&#8221; ]<br \/>\nthen<br \/>\necho ${color} is my favorite!<br \/>\nfi<\/p><\/blockquote>\n<p>Program #4<\/p>\n<blockquote><p>#!\/bin\/bash<br \/>\necho &#8220;Can you guess my favorite color?&#8221;<br \/>\nwhile true<br \/>\ndo<br \/>\nread color<br \/>\nif [ &#8220;$color&#8221; == &#8220;red&#8221; ]<br \/>\nthen<br \/>\necho &#8220;You guessed it!  ${color} is my favorite color!&#8221;<br \/>\nbreak<br \/>\nelse<br \/>\necho &#8220;Nope.  $color is not my favorite color.  Guess again!&#8221;<br \/>\nfi<br \/>\ndone<\/p><\/blockquote>\n<p>We&#8217;ll probably make it ask a few other questions and then some other cool things.  Might be fun!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m going to try to teach my 9 year old to program this weekend. \u00a0My first thought was to do scratch, and that seems kind of good, but I think BASH might just be a great place to go as well. Bash is found on the MAC and Linux which comprises every computer in our&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[166],"tags":[173,172,171],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/benincosa.com\/index.php?rest_route=\/wp\/v2\/posts\/706"}],"collection":[{"href":"https:\/\/benincosa.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/benincosa.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/benincosa.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/benincosa.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=706"}],"version-history":[{"count":5,"href":"https:\/\/benincosa.com\/index.php?rest_route=\/wp\/v2\/posts\/706\/revisions"}],"predecessor-version":[{"id":2763,"href":"https:\/\/benincosa.com\/index.php?rest_route=\/wp\/v2\/posts\/706\/revisions\/2763"}],"wp:attachment":[{"href":"https:\/\/benincosa.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=706"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/benincosa.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=706"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/benincosa.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=706"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}