What $ in shell scripts means?
In this video:
I saw the weird symbol:
When I’m start looking about it on the internet I discovered that a lot of people has asked, and answered the question for a long time.
As you can read in these question and its answer:
This code is useful in order to know the exist status of the last executed command.
In the Bash Reference Manual we can read:
($?) Expands to the exit status of the most recently executed foreground pipeline.Bash Reference Manual -> Special Parameters
So, if you are in a Unix-like operating systems. When you use “$?” you’ll received the exit status of the last executed command. The exit status will indicates the success or failure of the command.
A value of 0 indicates success. A non-zero value indicates an error or failure.