dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit b10f5de34bcef2a348bc43ece36ba68b1e46309f
parent 8d5e25b59dba21556414b9f5bd9cec79efa6d93b
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Tue, 28 Apr 2020 17:11:58 +0200

Fix argument handling in image scaling script

Diffstat:
M.local/bin/scale.sh | 13+++++++------
1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/.local/bin/scale.sh b/.local/bin/scale.sh @@ -1,13 +1,14 @@ #!/bin/sh -if [ $# -lt 1 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then - echo "Scale image sizes using Imagemagick's convert command." - echo "Usage: $0 <PERCENTAGE>% <FILE[S]>" - exit 0 +if [ $# -lt 2 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then + echo "Scale image sizes using Imagemagick's convert command." + echo "Usage: $0 <PERCENTAGE>% <FILE[S]>" + exit 0 fi scale="$1" shift for f in "$@"; do - echo "$f" - convert "$f" -resize "$scale" "scaled-$f" + out="scaled-${f}" + convert "$f" -resize "$scale" "$out" + printf '%s\n' "$out" done