Specify a single comma-delimited (or some other delimter) argument for each option:
$ ./my-script -a file1,file2,file3 -d file4,file5,file6 -r file7,file8
Then split the individual arguments after you parse the options. One way to do that:
IFS=, read a1 a2 a3 <<< $a_argument
or
IFS=, read -a a <<< $a_argument
Another option is to quote the argument, and let the script do the expansion:
./my-script -a '*.tex' -d '*.pdf'
$ ./my-script -a '*.txt' -d 'src1/*.tex sr2/*.tex'
where in the script:
#!/bin/bash
as=( $a_argument )
ds=( $d_argument )
This is similar to how find
handles, e.g, the -name
primary.