#79 quick-fedora-hardlink printf invalid directive
Opened 5 years ago by cra. Modified 5 years ago

There is a syntax error in printf:

quick-fedora-hardlink.zsh:printf:199: %2.2): invalid directive
=========   540000 processed (

Fix:

diff --git a/quick-fedora-hardlink.zsh b/quick-fedora-hardlink.zsh
index 9f698ba..45d3887 100755
--- a/quick-fedora-hardlink.zsh
+++ b/quick-fedora-hardlink.zsh
@@ -196,7 +196,7 @@ while IFS=$'\t' read -A tuple; do
     count=$((count+1))
     if (( count % 10000 == 0 )); then
         pct=$(( 100 * count / linecount ))
-        printf "========= %8d processed (%2.2) =========\n" $count $pct
+        printf "========= %8d processed (%3.2f%%) =========\n" $count $pct
     fi
     target=$tuple[1]
     targetinode=$(stat -c %i $target)

(I also changed it to 3 digits before the decimal and added the % sign to match other usage of printf printing out percentages, but maybe it will never show 100% and so only 2 digits are needed)


Login to comment on this ticket.

Metadata