{"id":756,"date":"2013-06-29T18:05:01","date_gmt":"2013-06-29T23:05:01","guid":{"rendered":"http:\/\/littlesvr.ca\/grumble\/?p=756"},"modified":"2013-06-29T18:05:01","modified_gmt":"2013-06-29T23:05:01","slug":"we-used-to-write-real-shell-scripts","status":"publish","type":"post","link":"http:\/\/littlesvr.ca\/grumble\/2013\/06\/29\/we-used-to-write-real-shell-scripts\/","title":{"rendered":"We used to write real shell scripts"},"content":{"rendered":"<p>I got a few requests from readers of my <a href=\"http:\/\/littlesvr.ca\/misc\/toronto-newfoundland-motorcycle\/\">Newfoundland trip<\/a> to give them maps so they can more easily figure out where I&#8217;ve been. Should be easy given that I recorded most of the trip using a OpenGPSTracker, but that&#8217;s a story for another time. This post is about the dying practice (not art) of shell scripting.<\/p>\n<p>To add the screenshots (which I already had) to the website (which was already written) I had to write a script like this:<\/p>\n<blockquote><p><code>for F in *jpg; do echo -n '&lt;a href=\"'; LONG=`echo -n $F | awk -F\/ '{printf \"OpenGPSTracker\/screenshots\/\"$NF;}'`; echo -n \"OpenGPSTracker\/screenshots\/\"`basename $LONG .jpg`'.png\"&gt;'; echo -n '&lt;img src=\"'; echo -n $F | awk -F\/ '{printf \"OpenGPSTracker\/screenshots\/\"$NF;}'; echo '\"&gt;&lt;\/a&gt;'; done<\/code><\/p><\/blockquote>\n<p>Which produced output like this, which I pasted into appropriate places in the HTML file:<\/p>\n<blockquote><p><code>&lt;a href=\"OpenGPSTracker\/screenshots\/day01-1.png\"&gt;&lt;img src=\"OpenGPSTracker\/screenshots\/day01-1.jpg\"&gt;&lt;\/a&gt;<br \/>\n&lt;a href=\"OpenGPSTracker\/screenshots\/day01-2.png\"&gt;&lt;img src=\"OpenGPSTracker\/screenshots\/day01-2.jpg\"&gt;&lt;\/a&gt;<br \/>\n&lt;a href=\"OpenGPSTracker\/screenshots\/day01-3.png\"&gt;&lt;img src=\"OpenGPSTracker\/screenshots\/day01-3.jpg\"&gt;&lt;\/a&gt;<br \/>\n&lt;a href=\"OpenGPSTracker\/screenshots\/day01-4.png\"&gt;&lt;img src=\"OpenGPSTracker\/screenshots\/day01-4.jpg\"&gt;&lt;\/a&gt;<br \/>\n...<\/code><\/p><\/blockquote>\n<p>I could have done it manually, adding one image at a time in Seamonkey, but for 47 images that would have been an awful lot of clicking, probably a half an hour&#8217;s worth.<\/p>\n<p>I couldn&#8217;t have written a script like that when I was a student, that&#8217;s not what bothers me. What does bother me is that I don&#8217;t know a lot of people who can write something like this on the fly, in order to save themselves the time and trouble of manual work. I know less than 5 people who would do it voluntarily, and maybe another 5 who could do it if you made them.<\/p>\n<p>Yes it&#8217;s unreadable and I won&#8217;t be able to figure out how it works tomorrow, but this is not software, it&#8217;s a single-use shell script. I remembered how it works long enough to get the menial task done.<\/p>\n<p>There has got to be a way to make writing, debugging, and learning shell scripting easier. A GUI of some sort.. I&#8217;ll put it on my never ending TODO list.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I got a few requests from readers of my Newfoundland trip to give them maps so they can more easily figure out where I&#8217;ve been. Should be easy given that I recorded most of the trip using a OpenGPSTracker, but that&#8217;s a story for another time. This post is about the dying practice (not art) &hellip; <\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,4],"tags":[],"class_list":{"0":"entry","1":"post","2":"publish","3":"author-andrew","4":"post-756","6":"format-standard","7":"category-opensource","8":"category-safeforseneca"},"_links":{"self":[{"href":"http:\/\/littlesvr.ca\/grumble\/wp-json\/wp\/v2\/posts\/756","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/littlesvr.ca\/grumble\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/littlesvr.ca\/grumble\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/littlesvr.ca\/grumble\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"http:\/\/littlesvr.ca\/grumble\/wp-json\/wp\/v2\/comments?post=756"}],"version-history":[{"count":7,"href":"http:\/\/littlesvr.ca\/grumble\/wp-json\/wp\/v2\/posts\/756\/revisions"}],"predecessor-version":[{"id":763,"href":"http:\/\/littlesvr.ca\/grumble\/wp-json\/wp\/v2\/posts\/756\/revisions\/763"}],"wp:attachment":[{"href":"http:\/\/littlesvr.ca\/grumble\/wp-json\/wp\/v2\/media?parent=756"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/littlesvr.ca\/grumble\/wp-json\/wp\/v2\/categories?post=756"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/littlesvr.ca\/grumble\/wp-json\/wp\/v2\/tags?post=756"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}