Skip to main content
deleted 12 characters in body
Source Link
Andy Dalton
  • 14.7k
  • 1
  • 29
  • 50

The two are not equivalent. In a line that contains $(foo), the $(foo) is replaced with the output of the command foo. For example:

$ echo "hello $(echo world)" hello world 

In a line that contains $foo, the $foo is replaced with the value of the environment variable named foo. For example:

 $ foo=world $ echo "hello $foo" hello world 

The two are not equivalent. In a line that contains $(foo), the $(foo) is replaced with the output of the command foo. For example:

$ echo "hello $(echo world)" hello world 

In a line that contains $foo, the $foo is replaced with the value of the environment variable named foo. For example:

 $ foo=world $ echo "hello $foo" hello world 

The two are not equivalent. In a line that contains $(foo), the $(foo) is replaced with the output of the command foo. For example:

$ echo "hello $(echo world)" hello world 

In a line that contains $foo, the $foo is replaced with the value of the variable named foo. For example:

 $ foo=world $ echo "hello $foo" hello world 
Source Link
Andy Dalton
  • 14.7k
  • 1
  • 29
  • 50

The two are not equivalent. In a line that contains $(foo), the $(foo) is replaced with the output of the command foo. For example:

$ echo "hello $(echo world)" hello world 

In a line that contains $foo, the $foo is replaced with the value of the environment variable named foo. For example:

 $ foo=world $ echo "hello $foo" hello world