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

Re: [SOLVED] Re: wine-unstable 64 bit



On Fri, 20 Jun 2014, berenger.morel@neutralite.org wrote:
> So I was wrong. Not really surprising honestly, but I think I have
> seen such assertion somewhere else from someone more knowledgeable
> than me.

Now you have the URL to the spec ;-)

http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html

> >HOWEVER, $(something) and `something` are not equivalent in POSIX,
> >they have
> >different behavior re. expansion of "something".  The code appears
> >to be
> >using $() correctly, though.
> 
> What is the difference then? Expansion in shell is a frequent issue
> for me when I try to write my scripts.

According to POSIX 2.6.3 (linked above):

----8<----

Within the backquoted style of command substitution, backslash shall retain
its literal meaning, except when followed by: '$', '`', or '\' (dollar sign,
backquote, backslash). The search for the matching backquote shall be
satisfied by the first backquote found without a preceding backslash; during
this search, if a non-escaped backquote is encountered within a shell
comment, a here-document, an embedded command substitution of the $(
command) form, or a quoted string, undefined results occur. A single-quoted
or double-quoted string that begins, but does not end, within the "`...`"
sequence produces undefined results.

With the $( command ) form, all characters following the open parenthesis to
the matching closing parenthesis constitute the command. Any valid shell
script can be used for command, except a script consisting solely of
redirections which produces unspecified results.

----8<----

Which is kinda hard to parse, but still... 

http://mywiki.wooledge.org/BashFAQ/082
http://stackoverflow.com/questions/4708549/shell-programming-whats-the-difference-between-command-and-command
http://stackoverflow.com/questions/9449778/what-is-the-benefit-of-using-instead-of-backticks-in-shell-scripts
http://unix.stackexchange.com/questions/5778/whats-the-difference-between-stuff-and-stuff

Read them all, and you'll get the picture.  Just say no to backticks :)

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh


Reply to: