Reputation: 11
I am using this 3 line shell script and it works to compare 2 files sizes.
FIRSTV=`stat -c%s crk03-rtr-002-20140504.rsc`
SECONDV=`stat -c%s crk03-rtr-002-20140503.rsc`
echo `expr $FIRSTV - $SECONDV`
If there a way I could do this on 1 line using expr or a better command which can tell me the number of bytes differnce between 2 files?
L
Upvotes: 1
Views: 153
Reputation: 785176
Yes you can do:
expr `stat -c%s crk03-rtr-002-20140504.rsc` - `stat -c%s crk03-rtr-002-20140503.rsc`
In BASH/ksh/dash and few more shells you can make use of (( ))
(arithmetic evaluation brackets):
echo $(( $(stat -c%s crk03-rtr-002-20140504.rsc) - $(stat -c%s crk03-rtr-002-20140503.rsc) ))
Upvotes: 1