Y
Hacker News
new
|
ask
|
show
|
jobs
by
gcmalloc
4662 days ago
useless use of cat
pv < "$1" > "$2"
2 comments
nitrogen
4662 days ago
Even if the
cat
at the beginning of a pipe isn't strictly necessary, it still helps readability to have everything flowing from left to right.
link
emillon
4662 days ago
I also advocate this "useless" use of cat, but you can write the redirection before the command:
<"$1" pv >"$2"
link
michaelmior
4661 days ago
The bigger problem is that using cat destroys the file size information.
link
nilved
4662 days ago
pv reads content from a file by default, so that can actually be reduced further to:
pv "$1" > "$2"
link
simcop2387
4662 days ago
Which will actually give better results this way, since it'll read the size of the file and use that to provide an estimate even.
link