I noticed a solution on Codewars which had the following syntax:
#!/bin/bash
seven () {
bc <<< "
scale=0
counter=0
m=$1
while( m > 99 ) {
counter = counter + 1
x = m / 10
y = m % 10
m = x - 2 * y
}
print m, \", \", counter
"
}
seven "$1"
My question is regarding the variables used(m,x,counter). How is it that bash allows to use variables without using $variable_name?
Are there special cases (such as wraping code with double-quotes) that allow for this?