Skip to content

Commit

Permalink
awk中将%s改为%.0f,改进awk大整数显示兼容性
Browse files Browse the repository at this point in the history
  • Loading branch information
hellofwy committed Dec 1, 2014
1 parent da0e272 commit 1df5ea4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sslib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ TRAFFIC_FILE=$DIR/sstraffic
SSSERVER_PID=$TMPDIR/ssserver.pid
SSCOUNTER_PID=$TMPDIR/sscounter.pid

TRA_FORMAT='%-5d\t%s\n'
TRA_FORMAT='%-5d\t%.0f\n'
TRAFFIC_LOG=$DIR/traffic.log
IPT_TRA_LOG=$TMPDIR/ipt_tra.log
MIN_TRA_LOG=$TMPDIR/min_tra.log
Expand Down Expand Up @@ -202,12 +202,12 @@ calc_remaining () {
printf("\t");
used=uta[port];
printf("%s", used);
printf("%.0f", used);
print_in_gb(used);
printf("\t");
remaining=limits[port]-uta[port];
printf("%s", remaining);
printf("%.0f", remaining);
print_in_gb(remaining);
printf("\n");
}
Expand Down

0 comments on commit 1df5ea4

Please sign in to comment.