-1

I am learning bash script and I am reading some sample code. Anyone can advice me the detail and meaning of the following code? Thanks in advance!

END_DATE=`date -u "+%FT%TZ" `
  • The backticks are native shell syntax, the % string formatting is described in the date man page. – stolenmoment Jan 08 '19 at 03:37
  • 1
    [What does ` (backquote/backtick) mean in commands?](https://unix.stackexchange.com/q/27428/56041), [Understanding backtick (`)](https://unix.stackexchange.com/q/48392/56041), [Problem with backticks in shellscript](https://stackoverflow.com/q/3927062/608639), [shell - When is variable in backticks expanded?](https://stackoverflow.com/q/43025353/608639), [What is the benefit of using $() instead of backticks in shell scripts?](https://stackoverflow.com/q/9449778/608639), etc. – jww Jan 08 '19 at 04:19
  • 1
    One question per question, please; and demonstrate at least that you have in fact googled. – tripleee Jan 08 '19 at 04:50
  • 1
    See also https://explainshell.com/ though the output it gives for this particular command isn't all that useful. Breaking it up helps. – tripleee Jan 08 '19 at 04:52

1 Answers1

0

The backticks are performing Command Sbustitution. The command inside the backticks is executed in a subshell and the result is assigned to the variable. (another syntax that would work the same in bash is $(command))

The string for the date command is how format is specified for the date command.

mlinkus
  • 89
  • 4