{"id":124,"date":"2005-07-05T21:43:24","date_gmt":"2005-07-05T20:43:24","guid":{"rendered":"http:\/\/www.nobugs.org\/blog\/?p=124"},"modified":"2005-07-05T21:50:19","modified_gmt":"2005-07-05T20:50:19","slug":"automate-the-automation","status":"publish","type":"post","link":"https:\/\/www.nobugs.org\/blog\/archives\/2005\/07\/05\/automate-the-automation\/","title":{"rendered":"Automate the automation"},"content":{"rendered":"<p>I am pragmatically lazy.  As such, I love setting up command aliases to suit whatever task I&#8217;m currently working on.  Prime candidates are &#8220;cd \/long\/path\/to\/a\/commonly\/used\/directory&#8221;.  These usually get single letter aliases, so I can flip between places in double-quick time.  Emacs (or gnuclient) is never more than a &#8220;e&#8221; away.  The old favourite &#8220;cd ..&#8221; gets shortened to &#8220;..&#8221;, and to complete the family I also have &#8220;&#8230;&#8221; and &#8220;&#8230;.&#8221; to go up faster.  I found myself using &#8220;find . -name&#8221; lots, so that is now &#8220;f.&#8221;.  I can connect to commonly used remote hosts quickly courtesy of some one-letter aliases and ssh-agent.<\/p>\n<p>All of this is fine and good, but I find that there&#8217;s a certain <i>inertia<\/i> that I have to overcome before I finally relent and add a new alias to my .bashrc file.  I type a long command and think, &#8220;hmm, I should really add an alias for that&#8221;.  But I often don&#8217;t get round to it.<\/p>\n<p>The solution is, of course, to automate it (meta-automation!).  At the point when I think &#8220;I should add an alias&#8221;, I can now just <a href=\"http:\/\/www.nobugs.org\/developer\/automate\/aliasadd\">run my newly created &#8220;aliasadd&#8221; function<\/a> which grabs the command I just typed and asks me for a name.  It then adds it to my shell startup files and also to the currently running shell.   I can now add a new alias in the time it used to take me to think &#8220;Gee, maybe I should add an alias for that last command&#8221;.<\/p>\n<p>(NB:  my .bashrc invokes a seperate .bash-aliases file (ie. by doing &#8220;. .bash-aliases&#8221;.  This helps to organize my startup scripts.  Therefore, the code below appends to a .bash-aliases file, whereas you might prefer it to target .bashrc)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I am pragmatically lazy. As such, I love setting up command aliases to suit whatever task I&#8217;m currently working on. Prime candidates are &#8220;cd \/long\/path\/to\/a\/commonly\/used\/directory&#8221;. These usually get single letter aliases, so I can flip between places in double-quick time. Emacs (or gnuclient) is never more than a &#8220;e&#8221; away. The old favourite &#8220;cd ..&#8221; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-124","post","type-post","status-publish","format-standard","hentry","category-general"],"_links":{"self":[{"href":"https:\/\/www.nobugs.org\/blog\/wp-json\/wp\/v2\/posts\/124","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.nobugs.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nobugs.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nobugs.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nobugs.org\/blog\/wp-json\/wp\/v2\/comments?post=124"}],"version-history":[{"count":0,"href":"https:\/\/www.nobugs.org\/blog\/wp-json\/wp\/v2\/posts\/124\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.nobugs.org\/blog\/wp-json\/wp\/v2\/media?parent=124"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nobugs.org\/blog\/wp-json\/wp\/v2\/categories?post=124"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nobugs.org\/blog\/wp-json\/wp\/v2\/tags?post=124"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}