{"id":45,"date":"2018-09-03T20:29:42","date_gmt":"2018-09-04T00:29:42","guid":{"rendered":"http:\/\/sites.nd.edu\/crivaldi\/?p=45"},"modified":"2019-11-05T14:50:13","modified_gmt":"2019-11-05T18:50:13","slug":"for-loops-in-bash","status":"publish","type":"post","link":"https:\/\/sites.nd.edu\/crivaldi\/2018\/09\/03\/for-loops-in-bash\/","title":{"rendered":"For loops in bash"},"content":{"rendered":"<p><em>*Note to all users: As of 07\/14\/2019, all posts have been moved to (and are being updated at <a href=\"https:\/\/crivaldi.github.io\">crivaldi.github.io . <\/a>I don&#8217;t have plans to shut this site down, but I have no idea how long it will be maintained by the university in the future.*<\/em><\/p>\n<h2>A collection of really useful links for bash scripting<\/h2>\n<h4><span style=\"text-decoration: underline\">For loops<\/span>:<\/h4>\n<h5>Here are some links to tutorials I&#8217;ve compiled so you can get some extra practice using\/crafting for loops. All of these will contain information we haven&#8217;t covered yet in addition to the basic for loop.<\/h5>\n<p><a href=\"https:\/\/jvns.ca\/blog\/2017\/03\/26\/bash-quirks\/\">https:\/\/jvns.ca\/blog\/2017\/03\/26\/bash-quirks\/<\/a><\/p>\n<p><a href=\"https:\/\/astrobiomike.github.io\/bash\/for_loops\">https:\/\/astrobiomike.github.io\/bash\/for_loops<\/a><\/p>\n<p><a href=\"https:\/\/ryanstutorials.net\/bash-scripting-tutorial\/bash-loops.php\">https:\/\/ryanstutorials.net\/bash-scripting-tutorial\/bash-loops.php<\/a><\/p>\n<p><a href=\"http:\/\/tldp.org\/LDP\/abs\/html\/loops1.html#EX22\">http:\/\/tldp.org\/LDP\/abs\/html\/loops1.html#EX22<\/a><\/p>\n<h5>Warning about using the output of &#8216;ls&#8217; as a set for a for loop:<\/h5>\n<p><a href=\"http:\/\/mywiki.wooledge.org\/ParsingLs\">http:\/\/mywiki.wooledge.org\/ParsingLs<\/a><\/p>\n<h4>More bash goodies:<\/h4>\n<p><a href=\"http:\/\/www.kfirlavi.com\/blog\/2012\/11\/14\/defensive-bash-programming\/\">http:\/\/www.kfirlavi.com\/blog\/2012\/11\/14\/defensive-bash-programming\/<\/a><\/p>\n<p><a href=\"https:\/\/google.github.io\/styleguide\/shell.xml\">https:\/\/google.github.io\/styleguide\/shell.xml<\/a><\/p>\n<p>Test your skills!!<\/p>\n<p><a href=\"https:\/\/cmdchallenge.com\/\">https:\/\/cmdchallenge.com\/<\/a><\/p>\n<p>Environment to test out code if you think something weird might be going on with your setup (warning &#8211; there might also be something weird with this setup, I haven&#8217;t played with it a whole lot).<\/p>\n<p><a href=\"https:\/\/repl.it\/languages\">https:\/\/repl.it\/languages<\/a><\/p>\n<h4><\/h4>\n<h4>Regex Practice<\/h4>\n<p><img decoding=\"async\" src=\"https:\/\/imgs.xkcd.com\/comics\/regular_expressions.png\" \/><\/p>\n<p>(Comic: www.xkcd.com\/208)<\/p>\n<h5>Lots of options for practice &#8211; choose your favorite!<\/h5>\n<p><a href=\"https:\/\/regexr.com\/\">https:\/\/regexr.com\/<\/a><\/p>\n<p><a href=\"https:\/\/regexone.com\/\">https:\/\/regexone.com\/<\/a><\/p>\n<p><a href=\"http:\/\/rubular.com\/\">http:\/\/rubular.com\/<\/a><\/p>\n<p>Regex combined with sed and awk: <a href=\"https:\/\/likegeeks.com\/regex-tutorial-linux\/?epik=0wDgLEvIWHzZ9\">https:\/\/likegeeks.com\/regex-tutorial-linux\/?epik=0wDgLEvIWHzZ9<\/a><\/p>\n<h5>Regex golf &#8211; match a string with the shortest possible expression:<\/h5>\n<p><a href=\"https:\/\/alf.nu\/RegexGolf\">https:\/\/alf.nu\/RegexGolf<\/a><\/p>\n<h5>Bash scripting cheatsheet: <a href=\"https:\/\/devhints.io\/bash\">https:\/\/devhints.io\/bash<\/a><\/h5>\n<h5>Common\/userful bash one-liners: <a href=\"http:\/\/www.bashoneliners.com\/\">http:\/\/www.bashoneliners.com\/<\/a><\/h5>\n<h5>Friend&#8217;s github page with too much awesome information to put it into any other category &#8211; spend some time digging around: <a href=\"https:\/\/github.com\/crazyhottommy\/getting-started-with-genomics-tools-and-resources\">https:\/\/github.com\/crazyhottommy\/getting-started-with-genomics-tools-and-resources<\/a><\/h5>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>*Note to all users: As of 07\/14\/2019, all posts have been moved to (and are being updated at crivaldi.github.io . I don&#8217;t have plans to shut this site down, but I have no idea how long it will be maintained by the university in the future.* A collection of really useful links for bash scripting &hellip; <a href=\"https:\/\/sites.nd.edu\/crivaldi\/2018\/09\/03\/for-loops-in-bash\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;For loops in bash&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2790,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[29880],"tags":[],"class_list":["post-45","post","type-post","status-publish","format-standard","hentry","category-unix"],"_links":{"self":[{"href":"https:\/\/sites.nd.edu\/crivaldi\/wp-json\/wp\/v2\/posts\/45","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sites.nd.edu\/crivaldi\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sites.nd.edu\/crivaldi\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sites.nd.edu\/crivaldi\/wp-json\/wp\/v2\/users\/2790"}],"replies":[{"embeddable":true,"href":"https:\/\/sites.nd.edu\/crivaldi\/wp-json\/wp\/v2\/comments?post=45"}],"version-history":[{"count":11,"href":"https:\/\/sites.nd.edu\/crivaldi\/wp-json\/wp\/v2\/posts\/45\/revisions"}],"predecessor-version":[{"id":52,"href":"https:\/\/sites.nd.edu\/crivaldi\/wp-json\/wp\/v2\/posts\/45\/revisions\/52"}],"wp:attachment":[{"href":"https:\/\/sites.nd.edu\/crivaldi\/wp-json\/wp\/v2\/media?parent=45"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sites.nd.edu\/crivaldi\/wp-json\/wp\/v2\/categories?post=45"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sites.nd.edu\/crivaldi\/wp-json\/wp\/v2\/tags?post=45"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}