svgcolor 405 B

123456789101112131415
  1. #!/bin/bash
  2. fromcolor="$1"
  3. tocolor="$2"
  4. if [[ -z "$fromcolor" || -z "$tocolor" ]]; then
  5. echo "Please specify colors."
  6. exit 1
  7. else
  8. find . -type f -name '*.svg' -print0 | while IFS= read -r -d '' file; do
  9. if [[ `grep "$fromcolor" "$file"` ]]; then
  10. echo "Replacing $fromcolor with $tocolor in $file"
  11. sed -i "s/$fromcolor/$tocolor/g" "$file"
  12. fi
  13. done
  14. fi