1 #!/bin/bash
   2 
   3 md5sum "$@" |
   4 while read sum file; do
   5     pre=${file:0:1}
   6     res=$(identify -format '%wx%h' "$file")
   7     new=${pre^}_${res:-0x0}-${sum:0:4}.${file##*.}
   8 
   9     mv -n "$file" "$new"
  10 done