I am trying to get these strings as output for items other than zero:[21-40][41-60][61-80][81-100]But the following script is somehow trying to evaluate the contents of the _FILENAME variable.#!/bin/bashfor i in 0 21 41 61 81do    if (( $i > 0 ))    then        _FILENAME=[$i-$((i+19))]    else        _FILENAME=First File    fi    echo $_FILENAMEdoneI'm sure I'm missing some syntax here.
How to evaluate concatenated string involving math in bash script
bash;scripting;shell script
Use double-quotes around variable references, like $_FILENAME. Without double-quotes, the shell will attempt to split the variable's contents into multiple words, and also expand any file globs (wildcard expressions) it finds. expressions like [21-40] are globs (this one matches any files named 2, 1 through 4, or 0). If you happen to have files by any matching names in the current directory, the list of files will be printed instead of the bracket expression. Thus, all you need to do is use:echo $_FILENAMEinstead of the unquoted version. BTW, it's also best to use lowercase (or mixed case) for shell variable names, to avoid conflicts with the many magic variables that have special meaning to the shell or other programs.