{"id":27508,"date":"2017-04-10T08:55:51","date_gmt":"2017-04-10T06:55:51","guid":{"rendered":"https:\/\/mamchenkov.net\/wordpress\/?p=27508"},"modified":"2017-04-19T09:37:08","modified_gmt":"2017-04-19T07:37:08","slug":"bashing-up","status":"publish","type":"post","link":"https:\/\/mamchenkov.net\/wordpress\/2017\/04\/10\/bashing-up\/","title":{"rendered":"Bashing up"},"content":{"rendered":"<!-- google_ad_section_start -->\n<p>Here are a couple of useful Bash resources that came upon my radar recently.<\/p>\n<p>First one is Julia Evans&#8217; blog post &#8220;<a href=\"https:\/\/jvns.ca\/blog\/2017\/03\/26\/bash-quirks\/\">Bash scripting quirks &amp; safety tips<\/a>&#8220;. \u00a0It&#8217;s quite introductory, but is has a few useful tips. \u00a0The one in particular I <del>either didn&#8217;t know about or completely forgot<\/del>\u00a0 <a href=\"https:\/\/mamchenkov.net\/wordpress\/2017\/03\/22\/bulletproof-bash-stop-script-on-error\/\">mentioned recently<\/a> is on how to make Bash scripts safer by using &#8220;<em>set -e<\/em>&#8220;, &#8220;<em>set -u<\/em>&#8220;, and &#8220;<em>set -o pipefail<\/em>&#8220;. \u00a0These go well with <a href=\"https:\/\/mamchenkov.net\/wordpress\/2017\/02\/05\/defensive-bash-programming\/\">another post<\/a> of mine not so long ago.<\/p>\n<p>The second is Sam Rowe&#8217;s blog post &#8220;<a href=\"http:\/\/samrowe.com\/wordpress\/advancing-in-the-bash-shell\/\">Advancing in the Bash Shell<\/a>&#8220;, which I found useful for all kinds of navigation and variable expansion in Bash command line. \u00a0Especially the bits on searching and reusing the history.<\/p>\n<!-- google_ad_section_end -->\n","protected":false},"excerpt":{"rendered":"<!-- google_ad_section_start -->\n<p>Here are a couple of useful Bash resources that came upon my radar recently. First one is Julia Evans&#8217; blog post &#8220;Bash scripting quirks &amp; safety tips&#8220;. \u00a0It&#8217;s quite introductory, but is has a few useful tips. \u00a0The one in particular I either didn&#8217;t know about or completely forgot\u00a0 mentioned recently is on how to &hellip; <a href=\"https:\/\/mamchenkov.net\/wordpress\/2017\/04\/10\/bashing-up\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Bashing up<\/span><\/a><\/p>\n<!-- google_ad_section_end -->\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"Bashing up #Bash #CLI #Linux #SysAdmin","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"_links_to":"","_links_to_target":""},"categories":[1,6,18,133,62],"tags":[3098,1960,3487],"keyring_services":[],"class_list":["post-27508","post","type-post","status-publish","format-standard","hentry","category-general","category-linux","category-programming","category-sysadmin","category-technology","tag-bash","tag-command-line","tag-julia-evans"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":27386,"url":"https:\/\/mamchenkov.net\/wordpress\/2017\/03\/05\/terminals-are-sexy\/","url_meta":{"origin":27508,"position":0},"title":"Terminals Are Sexy","author":"Leonid Mamchenkov","date":"March 5, 2017","format":false,"excerpt":"Terminals are sexy is a\u00a0curated list of Terminal frameworks, plugins & resources for CLI lovers. \u00a0There is plenty of links to applications, plugins and configurations. \u00a0For me personally, the most useful one was the link to sensible Bash configuration.","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2017\/03\/terminals-are-sexy-500x216.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":10202,"url":"https:\/\/mamchenkov.net\/wordpress\/2006\/06\/22\/bash-shortcuts\/","url_meta":{"origin":27508,"position":1},"title":"Bash shortcuts","author":"Leonid Mamchenkov","date":"June 22, 2006","format":false,"excerpt":"While reading about Joe Grossberg's making it in the Mac world, I noticed the \"ALT-.\" bash shortcut (he mentions it in his post). the fact that doing ALT-. at the bash command-line doesn't behave normally. Instead of repeating the last argument of the previous command, it outputs some characters. That\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":27291,"url":"https:\/\/mamchenkov.net\/wordpress\/2017\/02\/05\/defensive-bash-programming\/","url_meta":{"origin":27508,"position":2},"title":"Defensive BASH Programming","author":"Leonid Mamchenkov","date":"February 5, 2017","format":false,"excerpt":"If you write any Bash code that lasts more than a day, you should definitely read \"Defensive BASH Programming\" and follow the advice, if you haven't already. \u00a0It covers the following: Immutable global variables Everything is local main() Everything is a function Debugging functions Code clarity Each line does just\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":16720,"url":"https:\/\/mamchenkov.net\/wordpress\/2012\/09\/18\/bash-redirections-cheat-sheet\/","url_meta":{"origin":27508,"position":3},"title":"Bash Redirections Cheat Sheet","author":"Leonid Mamchenkov","date":"September 18, 2012","format":"link","excerpt":"Bash Redirections Cheat Sheet Even the experienced bash users will probably find a couple of new things in this cheat sheet.","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":27448,"url":"https:\/\/mamchenkov.net\/wordpress\/2017\/03\/22\/pushdpopd-vs-cd\/","url_meta":{"origin":27508,"position":4},"title":"pushd\/popd vs. cd","author":"Leonid Mamchenkov","date":"March 22, 2017","format":false,"excerpt":"My shell of choice and circumstance for most of my Linux life was Bash. \u00a0So, naturally, in my head, shell pretty much equals Bash, and I rarely think or get into situations when this is not true. \u00a0Recently, I was surprised by a script failure, which left me scratching my\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":26923,"url":"https:\/\/mamchenkov.net\/wordpress\/2016\/11\/21\/shell-parameter-expansion-default-values-for-shell-script-parameters\/","url_meta":{"origin":27508,"position":5},"title":"Shell parameter expansion : default values for shell script parameters","author":"Leonid Mamchenkov","date":"November 21, 2016","format":false,"excerpt":"When writing shell scripts, it's often useful to accept some command line parameters. \u00a0It's even more useful to have some defaults for those parameters. \u00a0Until now I've been using if statements to check if the parameter was empty, and if it was, to set it to the default value. \u00a0Something\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_sharing_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts\/27508","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/comments?post=27508"}],"version-history":[{"count":0,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts\/27508\/revisions"}],"wp:attachment":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/media?parent=27508"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/categories?post=27508"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/tags?post=27508"},{"taxonomy":"keyring_services","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/keyring_services?post=27508"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}