Comparing numbers in Bash

前端 未结 8 1982
栀梦
栀梦 2020-11-22 02:03

I\'m starting to learn about writing scripts for the bash terminal, but I can\'t work out how to get the comparisons to work properly. The script I\'m using is:



        
8条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-22 02:58

    There is also one nice thing some people might not know about:

    echo $(( a < b ? a : b ))
    

    This code will print the smallest number out of a and b

提交回复
热议问题