What is the benefit of using $() instead of backticks in shell scripts?

后端 未结 8 977
梦谈多话
梦谈多话 2020-11-22 05:05

There are two ways to capture the output of command line in bash:

  1. Legacy Bourne shell backticks ``:

    var=`command`
             
    
    
            
8条回答
  •  囚心锁ツ
    2020-11-22 05:30

    $() allows nesting.

    out=$(echo today is $(date))
    

    I think backticks does not allow it.

提交回复
热议问题