how to know how many arguments in bash script code example
Example 1: shell script get arguments
$ myscript.sh first_arg second_arg
# myscript.sh
#!/bin/bash
echo $1 # output: first_arg
echo $2 # output: second_arg
Example 2: bash count number of arguments
The number of arguments is $#