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

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


    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]

    I would see following problems quality wise with [1]:

    - The backtick version is not easily readable in high resolution screens
      or in terminals with small fonts 

    - There may be problems in distinguishing character ' from ` with sme
      particularly selected font.

    - The missing backtick is hard to find in highly quoted context, where
      single, double quotes and backticks play the code tune.

    - The backtick is awkwardly located in some keyboards. (possible
      orphan/adopt/NMU maintenance problem)

    - Lastly, isually impaired people have problems with non-easily
      dintinguishable content. ' and ` fall into this category.

    All Debian *sh compatible shells support $() and are thus POSIX/SUS
    compliant in this respect. 


I have reported bugs against backtick and suggested to change to use
the more readable alternative. The result was surprising. To quote
one message (bug closed reasoning):

     "If your development environment cannot display ` differently than ' ,
     you need to get a new one."

I'm askinf if it is ok to to reopen such bugs based of better QA
aspects. Possibly by providing patches if the maintainer is busy
elsewhere to handle such a "minor issue" from his perspective.



The Single UNIX Specification, Version 2 (SUSv2):
"Shell Command Language"

    ...The input characters within the quoted string that are
    also enclosed between "$(" and the matching ")" will not
    be affected by the double-quotes, but rather define that
    command whose output replaces the $(...)

Reply to: