4

Re-assigning (specifically, incrementing) a variable in a bash script

view full story
linux-howto

http://unix.stackexchange.com – I would like to simply re-assign a variable (to be specific, increment it by 0.050) in a bash script. In the following script that I wrote, i is an (integer) index, and mytime is a decimal/double/float number. "ps" (picosecond) is the unit of time that I am using in my calculations. #!/bin/bash mytime = 0.000 for i in {1..3} do echo "$i: $mytime ps" mytime = mytime + 0.050 done But, when I run this script using bash test.sh, I get these error messages: test.sh: line 2: mytime: command not found 1: ps test.sh: line 6: mytime: command not found 2: ps test.sh: line 6: mytime: command not (HowTos)