Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Feb 2011 20:06:26 +0000 (UTC)
From:      Thorsten Glaser <tg@mirbsd.org>
To:        freebsd-questions@freebsd.org
Subject:   Re: Backtick versus $()
Message-ID:  <loom.20110224T210222-768@post.gmane.org>
References:  <alpine.BSF.2.00.1102201027170.56885@wonkity.com> <4D61599E.4040008@gmail.com> <AANLkTinJKcy8NyFzW9=6yKEY%2BF_payQVM108_=B7Gyjr@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Andres Perera <andres.p <at> zoho.com> writes:

> > Nowadays all shells supports $() so I advise you to use it :).
> 
> no, not all shells support $()

They do, it’s mandated by POSIX. There’s no reason to support the
accidentally non-combining accent gravis (so-called “backtick”¹)
any more, unless you specifically target Solaris 10 and below’s
/bin/sh (which always had a ksh and /usr/xpg4/bin/sh which both
are POSIX compatible), or, worse, the Bourne shell (you know, the
one where you wrote ^ instead of | for pipes).


Warren Block <wblock <at> wonkity.com> writes:

> Still: aren't backticks and $() supposed to be equivalent?

Nope. The so-called backtick is deprecated, doesn’t support nesting,
and quoting (`…"…"…`) is Undefined, both with or without backslashes
in front of the (inner) double quotes. And there may be more.


① http://www.cl.cam.ac.uk/~mgk25/ucs/apostrophe.html explains quite
well why a “backtick” doesn’t exist and the accident behind this
ASCII character / codepoint. In short: never use it period.

bye,
//mirabilos
-- 
FWIW, I'm quite impressed with mksh interactively. I thought it was much
*much* more bare bones. But it turns out it beats the living hell out of
ksh93 in that respect. I'd even consider it for my daily use if I hadn't
wasted half my life on my zsh setup. :-) -- Frank Terbeck in #!/bin/mksh




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?loom.20110224T210222-768>