Shell loops using non-integers?

后端 未结 6 1797
悲哀的现实
悲哀的现实 2021-02-01 22:05

I wrote a .sh file to compile and run a few programs for a homework assignment. I have a \"for\" loop in the script, but it won\'t work unless I use only integers:



        
6条回答
  •  一个人的身影
    2021-02-01 22:50

    bash doesn't do decimal numbers. Either use something like bc that can, or move to a more complete programming language. Beware of accuracy problems though.

提交回复
热议问题