#!/bin/bash # usage: theme.sh source log.sh "theme.sh" THEME="$1" log DEBUG "setting theme $THEME" THEME_SRC="$XDG_CONFIG_HOME/theme" THEME_DEST="$HOME/.theme" log DEBUG "src $THEME_SRC -> dest $THEME_DEST" THEME_TEMPL="{{THEME}}" find -L "$THEME_SRC/" -type f | while read source_file; do destination_file=`echo "$source_file" | sed "s|^$THEME_SRC|$THEME_DEST|g"` mkdir -p `dirname $destination_file` log DEBUG "src $source_file -> dest $destination_file" cat "$source_file" | sed "s|$THEME_TEMPL|$THEME|g" > $destination_file done