I am trying to make script that has two switches -h and -d, -d having a mandatory number argument. After it there will be undetermined number of paths to file. 
So far, I have this, but the code seems to not recognize invalid switch -r (can be any name) and also does not work when I do not input any switches:

```
while getopts ":hd:" opt; do
case $opt in
    h)
            echo $usage
        exit 0
            ;;
    d)
        shift 2
            if [ "$OPTARG" -eq "$OPTARG" ] ; then # ako dalsi argument mame cislo
            depth=$OPTARG
        fi
            ;;
        \?)
        shift 1
            ;;
        :)
            shift 1
            ;;
esac
done
echo $1

```

when I type `./pripravne1.sh -d /home/OS/test_pz/test2` I get `./pripravne1.sh: [: /home/OS/test_pz/test2: integer expression expected`
when I type `./pripravne1.sh -r /home/OS/test_pz/test2` I get only empty string.