I\'ve got another bash-script problem I simply couldn\'t solve. It\'s my simplified script showing the problem:
while getopts \"r:\" opt; do case $opt in r)
This works for me:
#!/bin/bash while getopts "r" opt; do case $opt in r) fold=/dev dir=${2:-$fold} echo "asdasd" ;; esac done
Remove the colon (:) in the getopts argument. This caused getopt to expect an argument. (see here for more information about getopt)
: