To serve as a flexible tool, a script has to be qualified when it is called, given additional information about how and where to perform its task. Like commands, a script is qualified using parameters. Switches and arguments make a script reusable, which in turn reduces costs and time.
There are three methods available to extend Linux scripts using parameters. The first method uses positional parameters. A script can refer to the parameters on the command line by the position (or order) in which they appear. Because the other two methods rely on positional parameters, they are discussed first.
The Bash variable
$0 is the pathname of the script. It is not necessarily the full pathname, but ...