Skip to content

Instantly share code, notes, and snippets.

Created December 21, 2012 17:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/4354187 to your computer and use it in GitHub Desktop.
Save anonymous/4354187 to your computer and use it in GitHub Desktop.
This generates .png images using yuml.me. I'd like you to simplify my bash script so that I can learn more bash syntax/style.
#!/bin/bash
download_yuml_image() {
local file="$1"
local output_directory="$2"
instructions=$(tr "\\n" "," < <(cat $file))
image_basename=$(basename $(echo $file | sed -E "s/(.+)\.yuml$/\1/"))
image_filename="${output_directory}/${image_basename}.png"
wget -O "$image_filename" "http://yuml.me/diagram/plain;dir:TB/class/$instructions"
gm convert ${image_filename} -units PixelsPerInch -density 96x96 'xc:white' -flatten ${image_filename}
}
for file in manuscript/diagrams/class/*.yuml; do
download_yuml_image "$file" "manuscript/images/Design"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment