{"id":502,"date":"2009-07-12T22:52:43","date_gmt":"2009-07-13T02:52:43","guid":{"rendered":"http:\/\/scott.sherrillmix.com\/blog\/?p=502"},"modified":"2009-07-12T22:52:43","modified_gmt":"2009-07-13T02:52:43","slug":"tab-indented-standard-input-redirect-in-bash","status":"publish","type":"post","link":"http:\/\/scott.sherrillmix.com\/blog\/programmer\/tab-indented-standard-input-redirect-in-bash\/","title":{"rendered":"Tab Indented Standard Input Redirect in Bash"},"content":{"rendered":"
I managed to forget how to redirect standard input (when you want to feed a bunch of lines to a program) in a bash script while still indenting and had to go digging around for it. So I figured I’d make a note here so I don’t forget again and for anyone else in the same boat. It’s just You can use whatever you want to indicate the end of the input instead of EOF if it floats your boat (as long as you use the same thing both times) but unfortunately <<-<\/code> instead of
<<<\/code>. For example if you want to keep indentation within a loop:<\/p>\r\n[bash]\r\nfor i in 1 2 3 4;do\r\n\tcat<<-EOF\r\n\t\tThis is loop $i\r\n\t\tMore advanced stuff could go here\r\n\tEOF\r\ndone\r\n[\/bash]\r\n
<<-<\/code> doesn’t work with spaces for indentation (although I’m a tab man myself).<\/p>\r\n","protected":false},"excerpt":{"rendered":"I managed to forget how to redirect standard input (when you want to feed a bunch of lines to a program) in a bash script while still indenting and had to go digging around for it. So I figured I’d make a note here so I don’t forget again and for anyone else in the […]","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,5],"tags":[706,491,493,260,27,492,29],"_links":{"self":[{"href":"http:\/\/scott.sherrillmix.com\/blog\/wp-json\/wp\/v2\/posts\/502"}],"collection":[{"href":"http:\/\/scott.sherrillmix.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/scott.sherrillmix.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/scott.sherrillmix.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/scott.sherrillmix.com\/blog\/wp-json\/wp\/v2\/comments?post=502"}],"version-history":[{"count":8,"href":"http:\/\/scott.sherrillmix.com\/blog\/wp-json\/wp\/v2\/posts\/502\/revisions"}],"predecessor-version":[{"id":510,"href":"http:\/\/scott.sherrillmix.com\/blog\/wp-json\/wp\/v2\/posts\/502\/revisions\/510"}],"wp:attachment":[{"href":"http:\/\/scott.sherrillmix.com\/blog\/wp-json\/wp\/v2\/media?parent=502"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/scott.sherrillmix.com\/blog\/wp-json\/wp\/v2\/categories?post=502"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/scott.sherrillmix.com\/blog\/wp-json\/wp\/v2\/tags?post=502"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}