#!/bin/sh # # rdjpgcom_wrapper # # AUTHOR: # Dan Harkless # # COPYRIGHT: # This file is Copyright (C) 2006 by Dan Harkless, and is released under the # GNU General Public License . # # USAGE: # % rdjpgcom_wrapper file1.jpg [file2.jpg...] # # DESCRIPTION: # A wrapper around rdjpgcom that allows the specification of multiple files on # the commandline and that prints each comment with a prefix of # ": ". If a file has no comment, "No JPEG comment" is printed (a # la rdjpgcom's existing "Not a JPEG file" error). This can be handy for # sweeping through a collection of files that are supposed to have comments to # find the ones that don't. # # If I get a chance in the future I'll make a patch to rdjpcom and send it in # to the libjpeg maintainers so this wrapper won't be necessary. # # DATE MODIFICATION # ========== ================================================================== # 2006-08-29 Original. for f in "$@"; do printf "$f: " # a little slower than using echo -n / -e, but more portable comment=`rdjpgcom "$f"` if [ "X$comment" = "X" ]; then echo "No JPEG comment" else echo "$comment" fi done