"unbound variable" reading a boolean parameter from shell script command line
When you use set -u
, it's an error to dereference any variable that hasn't had a value explicitly assigned.
Thus, you need to set repeat=0
(or repeat=false
) at the top of your script, or to use a dereference method that has an explicit default behavior when the value is unset; see BashFAQ #112.