I am taking the Linux Essentials class and was doing well until I hit the scripting chapter. I simply do not understand these concepts. Wondering if someone can break the following down into ultra simplistic terms or point me to a better reference to learn it. I'm currently using netacad's curriculum.
From the text book (with minor formatting changes):
There are some special variables in addition to the ones you set. You
can pass arguments to your script:
#!/bin/bash echo "Hello $1"
A dollar sign followed by a number N corresponds to the Nth argument
passed to the script. If you call the example above with
output will be Hello Linux. The
$0variable contains the name of the
After a program runs, be it a binary or a script, it returns an exit
code which is an integer between 0 and 255. You can test this through
$?variable to see if the previous command completed successfully.
I understand how to assign variables and how they work with the
$ but the whole issue with
$1 — I just don't get it.
Any help would be much appreciated.