Skip to content

Commit

Permalink
Include portability fix for wc output
Browse files Browse the repository at this point in the history
Fix suggested by Alun Carr by mail on June 1 2014, because `wc` on OSX
prints the file size with a leading space.
  • Loading branch information
aklomp committed May 19, 2021
1 parent fe2c0da commit 9bd52ff
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions shrinkpdf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ check_smaller ()
if [ ! -f "$1" -o ! -f "$2" ]; then
return 0;
fi
ISIZE="$(wc -c "$1" | cut -f1 -d\ )"
OSIZE="$(wc -c "$2" | cut -f1 -d\ )"
ISIZE="$(echo $(wc -c "$1") | cut -f1 -d\ )"
OSIZE="$(echo $(wc -c "$2") | cut -f1 -d\ )"
if [ "$ISIZE" -lt "$OSIZE" ]; then
echo "Input smaller than output, doing straight copy" >&2
cp "$1" "$2"
Expand Down

0 comments on commit 9bd52ff

Please sign in to comment.