diff --git a/README.md b/README.md index 29604e9..7c0719e 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,3 @@ The script is licensed under the I didn't invent the wheel, just packaged it nicely. All credits go to the [Ghostscript](http://www.ghostscript.com) team. - -Many thanks to Dr. Alun J. Carr for fixing a portability issue on Mac OS X -regarding leading whitespace in the output of `wc`. diff --git a/shrinkpdf.sh b/shrinkpdf.sh index 0a4c5de..a0cc947 100644 --- a/shrinkpdf.sh +++ b/shrinkpdf.sh @@ -57,8 +57,8 @@ check_smaller () if [ ! -f "$1" ] || [ ! -f "$2" ]; then return 0; fi - ISIZE="$(echo $(wc -c "$1") | cut -f1 -d\ )" - OSIZE="$(echo $(wc -c "$2") | cut -f1 -d\ )" + ISIZE="$(wc -c "$1" | awk '{ print $1 }')" + OSIZE="$(wc -c "$2" | awk '{ print $1 }')" if [ "$ISIZE" -lt "$OSIZE" ]; then echo "Input smaller than output, doing straight copy" >&2 cp "$1" "$2"