[svlug] Evil Backquotes (was Re: how to copy a bunch of "." files?)
xtifr at dsp.net
Wed May 17 09:51:25 PDT 2000
Tin Le <tin at le.org> writes:
> The "csh" that is shipping on Linux is really just a symlink to
Bzzt, thanks for playing. Both csh and tcsh are available for Linux.
If your distribution doesn't offer you a choice of either or both,
then your distribution is more limited and inflexible than mine.
> And tcsh is not that bad.
I vehemently disagree, but now we're down to matters of personal
taste, which is a silly thing to argue about. Personally, I think
tcsh is one of the most evil programs to come along in decades. But I
freely admit that I have strong prejudices on the matter. :-)
> At least it is being maintained and bugfixed.
The same is true of csh (at least within Debian).
> The only thing I can see wrong with it is when people write csh shell
Yes, and this is the heart of the matter. As long as people continue
to promote csh to newbies, newbies will foolishly write csh scripts,
because they've had to learn the basics of csh programming in order to
maintain their own .login and .cshrc files.
This is why I recommend that newbies avoid csh at all costs -- it will
just make their life so much simpler to stick with a shell that they
can actually use for scripting.
> I had to untrained a number of my sysadmins on that bad habit.
Haven't we all? :-)
> One guy almost brought down our web servers because of his scripts. I
> turned him over to Perl and the problem was solved.
Yes, I've had even worse experiences (no "almost" involved), which is
why I feel so strongly on the topic.
Perl (or python) is almost always preferable for scripting. But
there's a learning curve involved. The natural inclination for
newbies is to experiment with the shell they're using. Usually
starting with the startup scripts, then moving on to more complex
stuff. If newbies were discouraged from using csh (or tcsh), then we
wouldn't have anywhere near as many disasters caused by foolish
attempts to use csh scripts.
Most experienced *NIX people have heard of "Csh programming considered
harmful", and know better, which is why I don't carp at people who use
it interactively themselves. All I really object to is people who
thrust csh at newbies. These people are dangerous and must be
> But $() is not available in sh [...]
It is in all the versions of sh I've seen that support backticks, and
in a few that don't (HP). I believe that POSIX mandates $() for sh,
but not backticks. (Probably worth checking on this.)
> I guess because I am such a portability oriented person and because '$()'
> was a feature that was not that much more useful (to me), I never tested
> how widely $() is supported.
This is probably the problem. You've been assuming that $() isn't
supported because you haven't been looking for it. When, in fact,
it seems to be a more portable solution than the one you settled on.
Or, if you've seen systems that support backticks but not $(), then
the conclusion I'm forced to is that neither is very portable. I
admit I haven't tried every *NIX out there, just four or five.
> > Thus, the aesthetics of portability and elegance unite in proclaiming
> > that $() is the One True Way, and that backticks are Evil. :-)
> Aw come on, there have to be better things to evangelize! ;-)
Oh sure, but people get so up in arms when you evangelize about the
big issues. I stay away from editor wars, from BSD vs SYSV flamewars,
from MS vs *NIX vs Apple wars, and all those other wars that generate
huge threads of noise and heat but little light. I stick to the small
quiet corners where I might, just possibly, be able to do a little
good for the world. :-)
> If Linux can have less security problems reported in the media, it would
> be easier for me to sell it to my clients :-).
Perhaps you'd have better luck selling BSD? Remaining flexible is one
of the keys to a long and successful career! ;-)
I like Linux better as a desktop system, but I think I trust the BSDs
a little more for serving.
Chris Waters xtifr at dsp.net | I have a truly elegant proof of the
or xtifr at debian.org | above, but it is too long to fit into
http://www.dsp.net/xtifr | this .signature file.
More information about the svlug