0

I am trying to find a way to use my previously defined variables in a shell script, when defining a new variable. For example, if I had:

set num = 20
set min = 1
set max = 10

I am looking for a way to create

set step = ($max - $min)/$num

Where at the moment, using the above results in the error:

"set: Variable name must begin with a letter."

I have found that I can use the expr command to do the calculation. E.g

expr {($max - $min)/$num} 

Will yield the correct result, but I have been unable to find a way to get this into a new variable.

1 Answer 1

0

you want the @ command

@ step = ($max - $min) / $num

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.