bash - Is command substitution $(foo) bashism? -


  FOO = $ (echo time)  

and

  FOO = `echo times`  

As far as I know, the first method is defined in the bash, while the other is defined in sh .

Consider the following use of command replacement in a sh script.

 #! / Bin / s FOO = $ (Echo Bar)  

Does this fall under definition?

Basisms, i.e. features not defined by POSIX (will not work in dashes, or normal / bin / sh).

This is the same thing, then this is not a statement nor the only bass Related to

Command Replacement
Commands replace the command instead of the command to be substituted for the command to give the name itself Command replacement occurs when the command Attached:

  $ (command)  

or ('backquoted' version):

Shell command command by executing commands in a subsecaled environment Extends and changes the command replacement with the standard output of the command It removes the sequences of one. At the end of the replacement or more new lines (embedded newlines are not removed prior to the end of the output, however, during the field split, they can be translated into spaces based on the value of the IFS, and it is effective quoted) .


Resources:

  • Thanks for @ed Deily for this good resource :)

Comments