{"id":835,"date":"2013-07-15T01:28:20","date_gmt":"2013-07-15T05:28:20","guid":{"rendered":"http:\/\/www.joshho.com\/blog\/?p=835"},"modified":"2013-07-15T01:30:59","modified_gmt":"2013-07-15T05:30:59","slug":"bash-pitfalls","status":"publish","type":"post","link":"https:\/\/www.joshho.com\/blog\/2013\/07\/15\/bash-pitfalls\/","title":{"rendered":"Bash Pitfalls"},"content":{"rendered":"<p>I was on IRC.. and noticed this link.. <a href=\"http:\/\/archiver.joshho.com\/display.php?full=1&#038;q=http:\/\/mywiki.wooledge.org\/BashPitfalls\">http:\/\/mywiki.wooledge.org\/BashPitfalls<\/a>,<br \/>\nif I had only known earlier&#8230;<\/p>\n<p>Tons of useful information on Bash Pitfalls&#8230; as well as tons of habits to change&#8230; :\/<\/p>\n<p>My error was specifically #22,<br \/>\ncmd1 &#038;&#038; cmd2 || cmd3 where I had assumed cmd2 is going to exit 0.<\/p>\n<p>In most of my usecases&#8230; my command is in the form of cmd1 || sleep # &#038;&#038; cmd3, I just naturally assume sleep is going to return 0.  <\/p>\n<p>Well, luckily for me, it has worked for the most part&#8230; but definitely need to change a number of my scripting habits&#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I was on IRC.. and noticed this link.. <a href=\"http:\/\/archiver.joshho.com\/display.php?full=1&#038;q=http:\/\/mywiki.wooledge.org\/BashPitfalls\">http:\/\/mywiki.wooledge.org\/BashPitfalls<\/a>,<br \/>\nif I had only known earlier&#8230;<\/p>\n<p>Tons of useful information on Bash Pitfalls&#8230; as well as tons of habits to change&#8230; :\/<\/p>\n<p>My error was specifically #22,<br \/>\ncmd1 &#038;&#038; cmd2 || cmd3 where I had assumed cmd2 is going to exit 0.<\/p>\n<p>In most of my usecases&#8230; my command is in the form of cmd1 || sleep # &#038;&#038; cmd3, I just naturally assume sleep is going to return 0.  <\/p>\n<p>Well, luckily for me, it has worked for the most part&#8230; but definitely need to change a number of my scripting habits&#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[27],"tags":[60,61,62],"class_list":["post-835","post","type-post","status-publish","format-standard","hentry","category-tidbit","tag-bash","tag-pitfalls","tag-shell"],"_links":{"self":[{"href":"https:\/\/www.joshho.com\/blog\/wp-json\/wp\/v2\/posts\/835","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.joshho.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.joshho.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.joshho.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.joshho.com\/blog\/wp-json\/wp\/v2\/comments?post=835"}],"version-history":[{"count":14,"href":"https:\/\/www.joshho.com\/blog\/wp-json\/wp\/v2\/posts\/835\/revisions"}],"predecessor-version":[{"id":849,"href":"https:\/\/www.joshho.com\/blog\/wp-json\/wp\/v2\/posts\/835\/revisions\/849"}],"wp:attachment":[{"href":"https:\/\/www.joshho.com\/blog\/wp-json\/wp\/v2\/media?parent=835"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.joshho.com\/blog\/wp-json\/wp\/v2\/categories?post=835"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.joshho.com\/blog\/wp-json\/wp\/v2\/tags?post=835"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}