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

Re: RFC: use readable $(cmd) syntax instead of unreadable `cmd`

Jari Aalto wrote:
>     I have seen following construct to be used in shell-context
>     (makefiles, sh-scripts, Perl):
>       `cmd` [1]
>     However, the POSIX standard and SUSv[23] declares alternative way of
>     accomplishing the same with in *sh context:
>       $(cmd) [2]

The only problem I see with $() is that older /bin/sh (SunOS) does not
support $(), but it does support ``.

When I make a /bin/sh, I want it able to be run on a /bin/sh, even if
that /bin/sh is on SunOS. I avoid $() and I do not consider `` a bug at
all. I use ``. If I need to nest, then I will use $() and usually mark
it as /bin/bash. Not a hard and fast rule, but as a guideline.

A line in a Makefile is simply a /bin/sh one-liner. Same rules apply as
for /bin/sh.

Perl suports qx() which I do tend to use over ``.

If I were to get a wishlst bug, I would mark it wontfix and leave it as
such. Even with a patch.

John H. Robinson, IV          jaqque@debian.org
                                                                 http  ((((
WARNING: I cannot be held responsible for the above,         sbih.org ( )(:[
as apparently my cats have learned how to type.          spiders.html  ((((

Reply to: