Created
May 12, 2014 16:32
-
-
Save chocomelonchan/3f5f6dde1a32e9e34d35 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $# -lt 3 ]; then | |
echo "Usage: append DIRECTION file1 file2 ... dest" | |
echo "i.e.: append -left 01.png 02.png dest.png" | |
echo "DIRECTION = [-left|-right|-top|-bottom]" | |
exit | |
fi | |
DIRECTION=$1 | |
shift; | |
ARGS=("$@") | |
DEST=${ARGS[((${#ARGS[@]}-1))]} | |
FILES="${ARGS[@]:0:((${#ARGS[@]}-1))}" | |
case "$DIRECTION" in | |
"-left"|"-right") OPTIONS='+append';; | |
"-top"|"-bottom") OPTIONS='-append';; | |
esac | |
case "$DIRECTION" in | |
"-left"|"-top") FILES=`echo "$FILES" | awk '{for (i=NF; i>0; i--) printf("%s ",$i);print ""}'`;; | |
esac | |
convert $OPTIONS $FILES $DEST |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment