Subtract two variables in Bash

后端 未结 8 1923
时光取名叫无心
时光取名叫无心 2020-12-02 06:33

I have the script below to subtract the counts of files between two directories but the COUNT= expression does not work. What is the correct syntax?

<         


        
8条回答
  •  情深已故
    2020-12-02 07:21

    You can use:

    ((count = FIRSTV - SECONDV))
    

    to avoid invoking a separate process, as per the following transcript:

    pax:~$ FIRSTV=7
    pax:~$ SECONDV=2
    pax:~$ ((count = FIRSTV - SECONDV))
    pax:~$ echo $count
    5
    

提交回复
热议问题