On Fri, Nov 25, 2011 at 1:46 PM, Scott <amorphous.yet....@gmail.com> wrote:
> First, I read from various sources that backticks (`command`) are basically
deprecated, with $(command) the preferred option (I may be a little loose with
this definition). man ksh even alludes to this:
>
> <snip>  ``' introduces an old-style command substitution <snip>
>
> Is there ANY differnece between the behavior of these, or is it just that
the newer style is preferred for readability?

A later paragraph in the "Substitution" section describes differences
in parsing.  The classical example is then seen here:
  echo '\$x'
  echo `echo '\$x'`
  echo $(echo '\$x')

The first and third both output
  \$x
but the second outputs
  $x

I.e., you can whip up a command that creates the output you desire,
and then wrap it in $(...) without having to go through it adding
backslashes like you do with backquotes.


> Second, again in man ksh, I read:
>
> Note that $(< foo) has the same effect as $(cat foo), but it is carried out
more efficiently because no process is started.
>
> When googling for similar examples, I always see the 'cat foo' example used.
So is this form simply a shorthand for 'cat somefile', and not any other
command (for example an awk or sed command)?

Yes.


Philip Guenther

Reply via email to