I am writing a shell script and wants to pass multiple options in an argument. Is it possible to do that like using getopts?
Requirement example:
./shell.sh -d db1 db2
should pass the values db1
and db2
as the values of the -d
option.
I am writing a shell script and wants to pass multiple options in an argument. Is it possible to do that like using getopts?
Requirement example:
./shell.sh -d db1 db2
should pass the values db1
and db2
as the values of the -d
option.
You can use one option multiple times and collect results in the array:
Code:
No. But you pass a single argument joined with, for example, a colon; or quoted
In the first case:
In the 2nd case (quoted)