I cant seem to work out how to use the last parameter passed to a shell script within the script itself.
For example, if I dont know how many parameters will be passed to the script, but want to work on the last one, I know the last parameter will be $x with x being the number stored in $#
So, if I pass 4 parameters from the shell like so:
$myScript param1 param2 param3
And I want to use param three within the script, how can I do this?
in general, u can use the $1, $2 as the positional parameter, and if you dont care about the number of parameters then just use the "shift" to pick up one by one parameter. for more on shift, check man shift.