#!/bin/bash # $HeadURL$ $LastChangedRevision$ set -e PROGNAME=$(basename $0) # Load support functions . $(pcms-config PCMS_SHARE_PREFIX)/scripts/support.sh main() { # Defaults for options VERBOSELEVEL=2 debug 10 "main: sof" # Process options while [ $# -ge 1 ]; do case $1 in -d) VERBOSELEVEL=$2; shift ;; --debug=*) VERBOSELEVEL=${1#*=} ;; -v|--verbose) VERBOSELEVEL=3 ;; --) shift; break ;; -*) error "main: $1: bad option" ;; *) break ;; esac shift done # Process arguments [ $# = 3 ] || usage SRC=$1 DST=$2 eval set -- $(encode --decode "$3") FOO=bar/bar [ $# -ge 1 ] || usage # Sanity checks and derivations # Guts eval "sed -e 1d $(for ASSIGNMENT in "$@"; do PLACEHOLDER=${ASSIGNMENT%%=*}; VALUE=${ASSIGNMENT#*=}; echo -n "-e 's/$PLACEHOLDER/${VALUE//\//\\\/}/g' "; done)" < $SRC > $DST } usage() { echo "Usage: $PROGNAME &2; exit 1; } main "$@"