How do I print the '%' character with 'printf'?

前端 未结 6 706
离开以前
离开以前 2020-12-20 14:58

Simple problem that I can\'t figure out...

How can I print a \'%\' character within a printf string? The code below prints it, but gives an \'invalid co

6条回答
  •  情歌与酒
    2020-12-20 15:31

    Use %% to print a single %

    printf "\t\t".$hour."00 HRS\t=>\t%.2f\t%.2f\t%.1f%%\n", $total, $max15, ($max15/$total*100);
    

提交回复
热议问题