Step 3 of build a build script project

Hello everyone!
I am having trouble in step 3 of the last project in command line course.
https://www.codecademy.com/courses/learn-the-command-line/projects/bash-scripting-p

Since we are creating a new build, let’s verify with the user that they have updated changelog.md with the current release version.

The first line of the file contains a version number with markdown formatting like so:

## 1.1.1
Read the first line of this file into a variable firstline. You can use the linux command head for this purpose.

I can’t figure out the solution to this step, why do we have to use $ in firstline=$(head -n 1 source/changelog.md). The dollar sign is used to access the variable but here we are extracting first line of changelog.md file.

Hi vashu1229,

The $(…) syntax is called command substitution. It basically lets bash perform the command contained in the $(…) separately, and replaces the $(…) with the result of the command, i.e. in this case, the string of the first line of the file.

Here’s some more information if you are interested:

https://www.gnu.org/software/bash/manual/html_node/Command-Substitution.html

All the best,