I have a case statement, when calling on the script I need it to accept these numbers as possible options of -d. There is a lot of them, so how do you do this without writing 100 more lines of code. I see many programs which allow an option to be any number so how do you do that?
case "$1:$2" in
-d:0.1|-D:0.1)
shift
echo "0.1"
shift
;;
-d:0.2|-D:0.2)
shift
echo "0.2"
shift
;;
-d:0.3|-D:0.3)
shift
echo "0.3"
shift
;;
-d:0.4|-D:0.4)
shift
echo "0.4"
shift
;;
...
#It continues this pattern all the way to 5.0, increasing by 0.1 each time ^^
esac
Example of Usage
$ example.sh -d 0.1
> 0.1
Is there a faster way to do this without writing all that code?