summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Huwald <jh@sotun.de>2014-11-05 14:52:14 (GMT)
committerJan Huwald <jh@sotun.de>2014-11-05 14:52:14 (GMT)
commit0dfe25c61564b5831eedefb5a88aac78de99f728 (patch)
tree0a8c4fc6e227bb3c4500798dc87b0bd7ffdb1d0b
parent26d04aa7dccb78b7e7d3cab1002358fa08d40a8b (diff)
factor out usage
-rwxr-xr-xanondcim6
1 files changed, 5 insertions, 1 deletions
diff --git a/anondcim b/anondcim
index 7a05970..1936da7 100755
--- a/anondcim
+++ b/anondcim
@@ -12,13 +12,17 @@ err() {
echo "$*" >&2
}
+die_usage() {
+ die "Usage: $0 [-p image_prefix] [-s destination_size (absolute or percentage)] [-d destination_directory] imagefile(s)"
+}
+
rand() {
# random number between 0 and $1 - 1
# read from urandom, sh interpretes numbers with leading 0 wrong, so prepend $1 which doesn't change the result
echo $(( $1$(tr -dc "0-9" < /dev/urandom | head -c $((${#1} + 1))) % $1 ))
}
-[ $# -gt 0 ] || die "Usage: $0 [-p image_prefix] [-s destination_size (absolute or percentage)] [-d destination_directory] imagefile(s)"
+[ $# -gt 0 ] || die_usage
which convert 2>/dev/null || die "ImageMagick (convert, identify) is not installed"
which jhead 2>/dev/null || which exiftool 2>/dev/null || die "jhead or exiftool has to be installed"
contact: Jan Huwald // Impressum