2 monospace, indentation, style
source | link

I am trying to get this stringthese 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 var_FILENAME variable.

#!/bin/bash
for i in 0 21 41 61 81 
  do
    if (( $i > 0 ))
        then
        _FILENAME="[$i-$((i+19))]"
    else
        _FILENAME="First File"
    fi
    echo $_FILENAME
done

I'm sure I'm missing some syntax here.

I am trying to get this string as output for items other than zero:

[21-40]
[41-60]
[61-80]
...
...

But the following script is somehow trying to evaluate the contents of the _FILENAME var.

#!/bin/bash
for i in 0 21 41 61 81 
  do
    if (( $i > 0 ))
        then
        _FILENAME="[$i-$((i+19))]"
    else
        _FILENAME="First File"
    fi
  echo $_FILENAME
done

I'm sure I'm missing some syntax here.

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/bash
for i in 0 21 41 61 81
do
    if (( $i > 0 ))
    then
        _FILENAME="[$i-$((i+19))]"
    else
        _FILENAME="First File"
    fi
    echo $_FILENAME
done

I'm sure I'm missing some syntax here.

    Post Migrated Here from serverfault.com
1
source | link

How to evaluate concatenated string involving math in bash script

I am trying to get this string as output for items other than zero:

[21-40]
[41-60]
[61-80]
...
...

But the following script is somehow trying to evaluate the contents of the _FILENAME var.

#!/bin/bash
for i in 0 21 41 61 81 
  do
    if (( $i > 0 ))
        then
        _FILENAME="[$i-$((i+19))]"
    else
        _FILENAME="First File"
    fi
  echo $_FILENAME
done

I'm sure I'm missing some syntax here.