tag:blogger.com,1999:blog-8250580320832498087.post7864226494763954358..comments2023-11-02T09:55:49.284+00:00Comments on Sam Liddicott: Re-factoring bashSam Liddicotthttp://www.blogger.com/profile/03970781114824321762noreply@blogger.comBlogger1125tag:blogger.com,1999:blog-8250580320832498087.post-54390299903040584042013-01-29T12:02:43.692+00:002013-01-29T12:02:43.692+00:00Heh, for a moment the naming of do_cmd() made me t...Heh, for a moment the naming of do_cmd() made me think, "Gosh, did I write that at some point?". But I'm hoping I didn't, based at least on the lack of "local" for retval, the loop structure, and the return value checking style.<br /><br />This reminds me of the discussions around more "Pythonic" ways of achieving a goal in Python. A true Bashista would prefer the refactored do_cmd(), but I've seen plenty of people write do_cmd() in the same fashion as the original.<br /><br />Really, though, the key issue with refactoring Bash scripts is that they rarely have much in the way of test harnesses or documentation. So it's sometimes tricky to figure out whether your refactorings have been beneficial or not :-|Anonymoushttps://www.blogger.com/profile/00007957317810511140noreply@blogger.com