[Dclug] useful bash commands: pmark

Bruce Israel israel at tux.org
Tue Oct 19 09:51:38 EDT 2010


On Mon, Oct 18, 2010 at 10:59:38PM -0400, James Ewing Cottrell 3rd wrote:
>   What part of "The Penalty for Writing CSH Scripts is Death" did you 
> not understand?

Sorry, that rule wasn't in existence when I started writing 'csh'
scripts, so I get grandfathered in.  :)

As Przemek said, and better than I would have, at the time I started
scripting, the shells available were 'sh' and 'csh/tcsh'.  For
interactivity, 'tcsh' beat 'sh' hands-down, and in my opinion, if
you are going to write scripts for a shell, it makes a lot more
sense to write them for the shell you use than the shell you don't
use.

This script is dated 2001, but that only means it's at least that
old.  I likely wrote the initial version earlier in the 1990's , but
wasn't in the habit of dating my scripts at that time.

FYI, that rule is an evolving one.  Since I started writing Python
scripts, I tend to believe to some extent that "The Penalty for
Writing BASH Scripts is Death".  Or at least any reasonably
complicated BASH scripts. 

> 
> Your Sentence is hereby Commuted to Rewriting All Your Scripts in a 
> Bourne based shell.

Thanks for reminding me.  I did start my cshtobash.py script a while
ago, but it's been really low priority (unless I need to fix or
extend something in one of these older scripts, I don't really care
what language it's implemented in).

> Geeze...next you'll be posting Pascal programs!

Sorry, it is more likely to be APL, which is a much cooler language.
Unfortunately I don't have an APL keyboard.  

I was going to say Lisp, but that wouldn't be a joke.

> Having said all that, I DO like the idea of making symlinks in a 
> well-known directory. Clever use of CDPATH, which I never liked much 
> because as you mentioned, all my development dirs tended to have the 
> same subdirs, and the shell gets confused.

Yeah, that's the cool aspect of this script.  As I said in a message
a while ago, the style of the script is a "who cares"; what's
important to me is building a cool feature or neat way to solve a
problem.

> Actually, you could have a two level architecture where your aliases 
> always worked off $CDPATH, so you could create multiple .dirs 
> directories in different places.

Hmmmm, that sounds interesting.  How would you use that, for
different projects?  I haven't needed anything that complex, so I
wouldn't bother doing that until I had a compelling use case
(solution in search of a problem),  but why don't you build it and
post it?

Bruce


More information about the Dclug mailing list