Shane Hathaway wrote: > I agree that bash is frequently easier, but its documentation is > scattered and IMHO bash is much more prone to bugs. Even the earlier > one-liner has a significant bug; it will fail if the path happens to > contain a space. Fortunately there's an obvious solution:
Bash is actually a very simple language and is well documented. It's just simple glue. I mean to even do math you call other processes to do it ($(()) is a shortcut, but still). > > abspath=$(readlink -f "$fn") In my opinion, that's simply a quirk, not a bug, that's well understood and common to all command shells that I know of. My original implementation was properly quoted, of course; I forgot to put in the quoted version in the e-mail. > > For me, the numerous warts like this usually tip the balance in favor of > a general purpose language. You must love doing lots of popens and reading and writing to pipes in a very manual fashion, then. If my problem involves scripting other commands (like this one), then I submit python is the wrong language. It the problem involves processing data that can be done with python modules, etc, then I'd be a fool to use bash for that. The trick is knowing where the line is. Another option is to blend solutions. A bit of python, a bit of bash, which I do do when it's appropriate. > > Shane > > > /* > PLUG: http://plug.org, #utah on irc.freenode.net > Unsubscribe: http://plug.org/mailman/options/plug > Don't fear the penguin. > */ > -- Michael Torrie Assistant CSR, System Administrator Chemistry and Biochemistry Department Brigham Young University Provo, UT 84602 +1.801.422.5771 /* PLUG: http://plug.org, #utah on irc.freenode.net Unsubscribe: http://plug.org/mailman/options/plug Don't fear the penguin. */
