Next line:
str=$(echo "${str// /-}")
results in Syntax error: Bad substitution
because you are not running your script with bash
. You execute your script with sh
or dash
, which causes an error.
EDIT: in order to fix your script so that it works with sh
and dash
in addition to bash
, you could replace the following lines:
str=$(printf "%${leng}s" "-")
str=$(echo "${str// /-}")
from
str=$(printf '=%.0s' $(seq $leng) | tr '=' '-')
source
share