#! /bin/bash string="$1" while read from to; do string="${string//\$\{$from\}/$to}" done < "$2" tee $3 <<<"$string"