How to read arguments from bash

bash

Solution

$0 is the name of the command
$1 first parameter
$2 second parameter
$3 third parameter etc. etc
$# total number of parameters

 for args in $* 

   blah blah 

Problem

I am curious as to how to pass in arguments via terminal to the bash script and read them and process the script functions based on the arguments. So if I did something like: ``` ./scriptname.sh install #or ./scriptname.sh assets install ``` How would I say, ok the first argument installs something, while the second sais to do something else based on the first argument.

Original source

Related problems