I'm looking for a recipe to provide a list of space-delimited IP addresses as named optional parameter to bash script. I'd like to get next functionality:
./bootstrap.sh -bx -c 192.168.1.1 192.168.1.2
Here b
and x
are some optional parameters and -c
is supposed to get a list of IP addresses as parameter. I use getops
to deal with parameters and for now I provide this parameter as comma-delimited string:
./bootstrap.sh -bx -c192.168.1.1,192.168.1.2
It works well, but looks ugly and non-intuitive for users. Any help appreciated.