[svlug] Evil Backquotes (was Re: how to copy a bunch of "." files?)
xtifr at dsp.net
Sun May 14 12:16:34 PDT 2000
dfox at belvdere.vip.best.com writes:
> > As far as I know, they're non-standard -- they certainly they don't
> > work in many ksh's. And they're hard for the eye to distinguish from
> AFAIK, ksh isn't as widely-used as bash/sh or csh.
Certainly not on linux, but on *NIXen as a whole, I think it may be
more widely used than bash. Or at least was, once.
> csh still seems to be a 'standard' shell
I'm glad you put that in quotes. It's a "standard" like MS-Word is a
"standard". And I'm not sure which I dislike more. :-)
With csh, you must use backticks -- but then a sensible person isn't
using csh (or tcsh) in the first place. And even if you are, you're
not worried about compatibility with any of the bourne-like shells.
> Bash is pretty standard at least on Linux, and backquotes work there,
> and I suspect they work equally well in other sh-compatible shells,
No, they don't. Older bourne shells often don't support the feature
at all, with any syntax. And ksh, which is still pretty popular, is
compatible with those older bourne shells, but introduced the
now-standard and simply more elegant $() syntax.
Basically, what it comes down to is that any bourne-like shell which
supports the feature will provide the $() syntax, but a few won't
provide the backticks syntax. Since the $() is preferable for other
reasons *and* slightly more common, why not use that?
> It's simply a very nice feature, useful in many situations.
I'm not dissing the feature, merely the syntax. Both backticks and
$() provide the feature. And backticks are harder to read, less
flexible, and slightly less standard.
I'm a little perplexed by your post. It seems to start out
disagreeing, but then ends in agreement. It's like you changed your
mind halfway through when it became clear what I meant, but you didn't
bother to go back and edit the earlier text in light of your new
insight. The result is somewhat confusing. Oh well...
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