[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Shell Scripts



On Sun, Apr 24, 2005 at 05:53:36PM -0400, Sean Davis wrote:
} On Sun, Apr 24, 2005 at 05:45:28PM -0400, Gregory Seidman wrote:
} > On Sun, Apr 24, 2005 at 02:30:19PM -0600, Art Edwards wrote:
} > } I'm trying to run a shell script with tcsh (my default shell is tcsh).
} > } My first line of the script is
} > } 
} > } #!/bin/tcsh
} > } 
} > } However, the shell seems to be running in the bourne shell (sh). I say
} > } this because I can't get the shell to source my .cshrc file and the ls
} > } command gives the same result as I get inside sh.
} > } 
} > } What am I doing wrong?
} > 
} > The first thing you are doing wrong is attempting to script in csh (or
} > tcsh). Please use Google to find "csh considered harmful" and read it.
} 
} While I do agree that scripting in csh/tcsh is horrid compared to
} bash/pdksh/ksh/sh, I don't think the "harmful" diagnosis is quite correct.
} Suboptimal, yes. Counterintuitive, most definetly. Harmful implies that it
} actually causes harm, which it doesn't, unless you count the bruise you get
} from banging your head on your desk trying to get {,t}csh to do what you
} want.

It is Tom Christiansen who makes the claim that it is harmful. I consider
his explanation of what is wrong with csh to be the best expression out
there of why one should not use (t)csh for scripting, so I point people to
it. Whether (t)csh scripting is actually harmful is a different story. It
is definitely, as you say, suboptimal and counterintuitive and I think
Tom's essay makes that point very well. You may feel free to argue that he
should not have used "harmful" in his title, but "csh considered harmful"
is unquestionably the right phrase to use on Google to find the essay I
intended the OP to read.

--Greg



Reply to: