I have a bit of an issue with the following command which extracts a tar file & prints how many files have been extracted every second:
tar -xvf some_tar.tar -C a/directory | awk 'systime() > lasttime { lasttime = systime(); printf "%d files\n", NR; fflush(stdout) }'
Even if the tar command fails, the awk command will still return 0, which is undesirable because it does not reflect that the tar command failed.
How might I go about fixing this?