#!/bin/sh set -e if [ $# -lt 1 ]; then echo "usage: $0 ..." exit 1 fi if ! command -v tidy 2>&1; then echo "error: the 'tidy' executable is required for formatting" exit 1 fi # Function to process a single file process() { FILE="$1" # Ensure the file exists if [ ! -f "$FILE" ]; then echo "error: '$FILE' does not exist." return fi # Format SVG. tidy -xml -i -m -q -w 0 "$FILE" # Remove `` header, if present. sed -i '1{/^/d' "$FILE" # Replace the contents of \ ' "$FILE" echo "Processed $FILE" } # Iterate over each file provided as an argument for file in "$@"; do process "$file" done