{"id":17,"date":"2006-07-08T08:34:01","date_gmt":"2006-07-08T12:34:01","guid":{"rendered":"http:\/\/scott.sherrillmix.com\/blog\/uncategorized\/reading-standard-input-in-a-bash-shell-script\/"},"modified":"2007-02-13T01:00:28","modified_gmt":"2007-02-13T05:00:28","slug":"reading-standard-input-in-a-bash-shell-script","status":"publish","type":"post","link":"http:\/\/scott.sherrillmix.com\/blog\/programmer\/reading-standard-input-in-a-bash-shell-script\/","title":{"rendered":"Reading Standard Input in a Bash Shell Script"},"content":{"rendered":"

I guess this is obvious to most people but it took me quite a while to dig it out on the internet. I wanted my bash script to be able to read from standard input like cat sourcefile.txt|bash myscript.bash<\/code>. It turns out the standard input can be read from \/dev\/stdin<\/code>. So if I wanted to sort<\/code> the standard input, myscript.bash would look like: sort \/dev\/stdin<\/code><\/p>\r\n\r\n

I think this is probably basic UNIX knowledge but I’m not a programmer.<\/p>","protected":false},"excerpt":{"rendered":"I guess this is obvious to most people but it took me quite a while to dig it out on the internet. I wanted my bash script to be able to read from standard input like cat sourcefile.txt|bash myscript.bash. It turns out the standard input can be read from \/dev\/stdin. So if I wanted to […]","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,369,391,30,31,28,27,26,29],"_links":{"self":[{"href":"http:\/\/scott.sherrillmix.com\/blog\/wp-json\/wp\/v2\/posts\/17"}],"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=17"}],"version-history":[{"count":0,"href":"http:\/\/scott.sherrillmix.com\/blog\/wp-json\/wp\/v2\/posts\/17\/revisions"}],"wp:attachment":[{"href":"http:\/\/scott.sherrillmix.com\/blog\/wp-json\/wp\/v2\/media?parent=17"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/scott.sherrillmix.com\/blog\/wp-json\/wp\/v2\/categories?post=17"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/scott.sherrillmix.com\/blog\/wp-json\/wp\/v2\/tags?post=17"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}